Package microsim.data
Class ExperimentManager
java.lang.Object
microsim.data.ExperimentManager
A singleton meaning at most one instance of the class exists at the time. This is a utility class used to create ana
manage experiment setup. It makes copies of input folder into output and create experiment run record into output
database.
-
Field Summary
Modifier and TypeFieldDescriptionboolean
The flag determines if the tool must copy input resources into output folder.boolean
The flag determines if output database must automatically be created. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Walks recursively over all files in the directory and copies them to a new destination.@NonNull Experiment
createExperiment
(@NonNull String multiRunId) Creates a new instance ofExperiment
with the provided id; uses current time as the timestamp.static @NonNull ExperimentManager
@NonNull Experiment
setupExperiment
(@NonNull Experiment experiment, @NonNull Object... models) Creates the experiment setup by copying input files to the output folder.
-
Field Details
-
copyInputFolderStructure
public boolean copyInputFolderStructureThe flag determines if the tool must copy input resources into output folder. -
saveExperimentToDatabase
public boolean saveExperimentToDatabaseThe flag determines if output database must automatically be created.
-
-
Method Details
-
getInstance
- Returns:
- the instance of
ExperimentManager
.
-
createExperiment
Creates a new instance ofExperiment
with the provided id; uses current time as the timestamp.- Parameters:
multiRunId
- The experiment id.- Returns:
- an instance of
Experiment
. - Throws:
NullPointerException
- whenmultiRunId
isnull
.
-
copy
public void copy(@NonNull @NonNull String fileName, @NonNull @NonNull String outFolder) throws IOException Walks recursively over all files in the directory and copies them to a new destination. It the output exists overrides it. Ignores files and folders starting with dots.- Parameters:
fileName
- The source file/directoryoutFolder
- The destination folder.- Throws:
IOException
- when something goes wrong (permissions / lack of space).NullPointerException
- when at least one of the input parameters isnull
.
-
setupExperiment
@NonNull public @NonNull Experiment setupExperiment(@NonNull @NonNull Experiment experiment, @NonNull @NonNull Object... models) Creates the experiment setup by copying input files to the output folder. In addition, creates a database if needed and establishes a connection to it.- Parameters:
experiment
- AnExperiment
object.models
- An array of models.- Returns:
- the updated
experiment
. - Throws:
NullPointerException
- when at least one input parameter isnull
.RuntimeException
- when file copying fails.
-