Class FilesFunc
java.lang.Object
org.variantsync.boosting.eval.util.FilesFunc
Utilities class for dealing with files.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
changeProperties
(String filePath, int count) Changes the debug folder path in the properties file after each experiment.static void
clearDebugFolders
(String path) Clears all debug folders at the start of the experiment.static boolean
deleteFolder
(File folder) 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.
-
Constructor Details
-
FilesFunc
public FilesFunc()
-
-
Method Details
-
changeProperties
Changes the debug folder path in the properties file after each experiment.- Parameters:
filePath
- The file path of the properties file to be modifiedcount
- The count of experiments. If set to -1, the folder path will be reset to its original value
-
deleteInputfiles
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
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 fileNullPointerException
- 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 filefilepath
- The path to the file where the JSON data will be savedsplName
- 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 scenarioscenarioSize
- the size of each scenariopercentMappings
- an array of integers representing the percentage mappingsscenario
- the name of the scenarioruns
- the number of runsfilepath
- the filepath where the results will be saved- Throws:
IOException
- if an I/O error occurs while writing to the file
-
clearDebugFolders
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.
-