Package microsim.data

Class ExperimentManager

java.lang.Object
microsim.data.ExperimentManager

public class ExperimentManager extends Object
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 Details

    • copyInputFolderStructure

      public boolean copyInputFolderStructure
      The flag determines if the tool must copy input resources into output folder.
    • saveExperimentToDatabase

      public boolean saveExperimentToDatabase
      The flag determines if output database must automatically be created.
  • Method Details

    • getInstance

      @NonNull public static @NonNull ExperimentManager getInstance()
      Checks manager, if null, generates a new instance of ExperimentManager, else uses the existing one.
      Returns:
      the instance of ExperimentManager.
    • createExperiment

      @NonNull public @NonNull Experiment createExperiment(@NonNull @NonNull String multiRunId)
      Creates a new instance of Experiment with the provided id; uses current time as the timestamp.
      Parameters:
      multiRunId - The experiment id.
      Returns:
      an instance of Experiment.
      Throws:
      NullPointerException - when multiRunId is null.
    • 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/directory
      outFolder - The destination folder.
      Throws:
      IOException - when something goes wrong (permissions / lack of space).
      NullPointerException - when at least one of the input parameters is null.
    • 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 - An Experiment object.
      models - An array of models.
      Returns:
      the updated experiment.
      Throws:
      NullPointerException - when at least one input parameter is null.
      RuntimeException - when file copying fails.