Class FilesFunc

java.lang.Object
org.variantsync.boosting.eval.util.FilesFunc

public class FilesFunc extends Object
Utilities class for dealing with files.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    changeProperties(String filePath, int count)
    Changes the debug folder path in the properties file after each experiment.
    static void
    Clears all debug folders at the start of the experiment.
    static boolean
    Recursively deletes a folder and all its subdirectories and files.
    static void
    deleteInputfiles(String inputFolder)
    Deletes all product files in the specified input folder to prepare for the next test.
    static void
    writeFiles(double[][] scores, int scenarioSize, int[] percentMappings, String scenario, int runs, String filepath)
    Saves the results to a file in the specified filepath.
    static void
    writeFiles(String jsonstring, String filepath, String splName)
    Writes the given JSON data to a specified file.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FilesFunc

      public FilesFunc()
  • Method Details

    • changeProperties

      public static void changeProperties(String filePath, int count)
      Changes the debug folder path in the properties file after each experiment.
      Parameters:
      filePath - The file path of the properties file to be modified
      count - The count of experiments. If set to -1, the folder path will be reset to its original value
    • deleteInputfiles

      public static void deleteInputfiles(String inputFolder) throws IOException
      Deletes all product files in the specified input folder to prepare for the next test.
      Parameters:
      inputFolder - The path to the folder containing the product files to be deleted.
      Throws:
      IllegalArgumentException - if the inputFolder is null or empty.
      IOException - if an I/O error occurs while deleting the files.
    • deleteFolder

      public static boolean deleteFolder(File folder)
      Recursively deletes a folder and all its subdirectories and files.
      Parameters:
      folder - the folder to be deleted
      Returns:
      true if the folder and all its contents were successfully deleted, false otherwise
      Throws:
      SecurityException - if a security manager exists and denies delete access to the file
      NullPointerException - if the folder is null
    • writeFiles

      public static void writeFiles(String jsonstring, String filepath, String splName) throws IOException
      Writes the given JSON data to a specified file.
      Parameters:
      jsonstring - The JSON data to be written to the file
      filepath - The path to the file where the JSON data will be saved
      splName - The name of the file to be saved
      Throws:
      IOException - If an I/O error occurs while writing the file
    • writeFiles

      public static void writeFiles(double[][] scores, int scenarioSize, int[] percentMappings, String scenario, int runs, String filepath) throws IOException
      Saves the results to a file in the specified filepath.
      Parameters:
      scores - a 2D array of double values representing the scores for each scenario
      scenarioSize - the size of each scenario
      percentMappings - an array of integers representing the percentage mappings
      scenario - the name of the scenario
      runs - the number of runs
      filepath - the filepath where the results will be saved
      Throws:
      IOException - if an I/O error occurs while writing to the file
    • clearDebugFolders

      public static void clearDebugFolders(String path)
      Clears all debug folders at the start of the experiment. This function takes a path as input and recursively deletes all debug folders found within that path. Debug folders are typically used for storing temporary files or logs during the debugging process.
      Parameters:
      path - The path to the directory where debug folders are located.
      Throws:
      IllegalArgumentException - if the path is null or empty.
      SecurityException - if a security manager exists and denies delete access to the files.