public class Output extends Object implements Steppable, sim.portrayal.inspector.ProvidesInspector, Closeable
All added Collector
s are processed every step or in their associated
interval, with their OutputWriter
.
This class also implements ProvidesInspector
to provide an
Inspector
which displays each added Collector
together with
other objects to be inspected that can be added separately.
Modifier and Type | Class and Description |
---|---|
static class |
Output.CollectorOption
Output.CollectorOption specify how an added Collector is handled
by the Output object where it is added. |
Constructor and Description |
---|
Output(Path outputPath)
Constructs a new
Output instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
addCollector(Collector collector,
Output.CollectorOption... options)
Adds a
Collector . |
void |
close() |
static String |
generateFileName(int index,
String first,
String... other)
Generates a file name from given string and an index number.
|
static String |
generateFileName(String first,
String... other)
Generates a file name with each given string separated from the other.
|
Inspector |
provideInspector(GUIState state,
String name) |
void |
setOutputPath(Path outputPath)
Sets the output path for all associated writers.
|
void |
step(SimState state) |
String |
toString() |
public Output(Path outputPath)
Output
instance. Creates a directory at given
path.outputPath
- an empty directory where the output gets written topublic static String generateFileName(String first, String... other)
first
- the first partother
- the other partspublic static String generateFileName(int index, String first, String... other)
index
- the index number, added lastfirst
- the first partother
- the other parts added after the first partpublic boolean addCollector(Collector collector, Output.CollectorOption... options)
Collector
.collector
- the collector to be addedoptions
- the options how this collector is handledCollection.add(E)
)public void setOutputPath(Path outputPath)
outputPath
- public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public Inspector provideInspector(GUIState state, String name)
provideInspector
in interface sim.portrayal.inspector.ProvidesInspector