Output Directory
This class provides basic context for creating and writing output files. Files and directories created by instances of this class will be relative to the Path supplied at creation.
Side-effects at construction
outDir (the base directory) is created eagerly.
out (the log writer) is created eagerly only when autoCreateOutFile is
true(the default). Whenfalse, out is a discard-all writer wrappingWriter.nullWriter()and no file is created on disk.The four subdirectory properties (excelDir, dbDir, csvDir, plotDir) are lazy. Each subdirectory is created on first access to its property and not before. Code that never reads a subdirectory property never causes its directory to appear on disk.
The laziness lets callers that fan out an OutputDirectory per simulation run (e.g. ParallelDesignedExperiment per design point, ConcurrentScenarioRunner per scenario) avoid materialising empty format-specific subdirectories under every run's folder when the model never writes Excel / DB / CSV / plot artefacts. The autoCreateOutFile flag lets those same callers suppress the per-run log file when they're operating in a flat (shared-directory) mode where a per-run log file would be noise rather than signal.
Parameters
the base output directory to use for writing text files relative to this OutputDirectory instance
the name of the file backing the out property when autoCreateOutFile is true; ignored otherwise
when true (default), create outFileName under outDir at construction time and back out with it. When false, no file is created and out is a no-op writer that discards everything written to it.
Constructors
Creates a OutputDirectory with the current program launch directory with the base directory
Properties
Can be used like System.out, but writes to a file in outDir when autoCreateOutFile is true. When false, this writer discards everything written to it (wraps Writer.nullWriter()) and no file is created on disk.
Functions
Makes a new PrintWriter within the base directory with the given file name
Makes a new PrintWriter within the base directory with the given file name
Makes a Path to the named subdirectory within the base directory
Creates a RenderContext whose output and plot directories are rooted in this OutputDirectory.