Package microsim.statistics
Class TimeSeries
java.lang.Object
microsim.statistics.TimeSeries
- All Implemented Interfaces:
EventListener
,UpdatableSource
A container for multiple synchronized time series.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new series to the existing one.void
addSeries
(@NonNull DoubleSource source, @NonNull Enum<?> valueID) Adds a new series to the existing one.void
Adds a new series to the existing one.void
addSeries
(@NonNull LongSource source, @NonNull Enum<?> valueID) Adds a new series to the existing one.void
Adds a new series to the existing one.getSeries
(int seriesIndex) Returns a series at the given index.int
Returns the number of series.void
Performs one of the defined actions.void
Stores the entire data content in the output file in the same directory.void
saveToFile
(@NonNull String path, @NonNull String fileName) Stores the entire data content in the given output file.void
saveToFile
(@NonNull String path, @NonNull String fileName, boolean withTimes) Stores the entire data content in the given output file.void
saveToFile
(@NonNull String path, @NonNull String fileName, boolean withTimes, char separator) Stores the entire data content in the given output file.void
Updates all the contained time series and the current time.
-
Field Details
-
DEFAULT_SEPARATOR
public static final char DEFAULT_SEPARATORThe character used to separate data in the output file: ','- See Also:
-
series
-
absTimes
protected cern.mateba.list.tdouble.DoubleArrayList absTimes -
descTimes
-
-
Constructor Details
-
TimeSeries
public TimeSeries()Creates a new time series container.
-
-
Method Details
-
addSeries
Adds a new series to the existing one.- Parameters:
aSeries
- An instance ofSeries
.- Throws:
NullPointerException
- whenaSeries
isnull
.
-
addSeries
Adds a new series to the existing one.- Parameters:
source
- ADoubleSource
object.valueID
- The value identifier defined by source object.- Throws:
NullPointerException
- when any of the input parameters isnull
.
-
addSeries
Adds a new series to the existing one.- Parameters:
source
- TheIntSource
object.valueID
- The value identifier defined by source object.- Throws:
NullPointerException
- when any of the input parameters isnull
.
-
addSeries
Adds a new series to the existing one.- Parameters:
source
- The LongSource object.valueID
- The value identifier defined by source object.- Throws:
NullPointerException
- when any of the input parameters isnull
.
-
addSeries
public void addSeries(@NonNull @NonNull Object target, @NonNull @NonNull String variableName, boolean getFromMethod) Adds a new series to the existing one.- Parameters:
target
- A generic source object.variableName
- The name of the field or the method returning the variable to be probed.getFromMethod
- Specifies if valueName is a method or a property value.- Throws:
NullPointerException
- when any of the input parameters isnull
.
-
updateSource
public void updateSource()Updates all the contained time series and the current time.- Specified by:
updateSource
in interfaceUpdatableSource
-
getSeries
Returns a series at the given index.- Parameters:
seriesIndex
- The name of the series.- Returns:
- The asked series or
null
if series does not exist. - Throws:
IndexOutOfBoundsException
- IfseriesIndex
is out of bounds.
-
getSeriesCount
public int getSeriesCount()Returns the number of series.- Returns:
- The number of series.
-
saveToFile
public void saveToFile()Stores the entire data content in the output file in the same directory. -
saveToFile
Stores the entire data content in the given output file.- Parameters:
path
- The optional path string.fileName
- The name of the output file.
-
saveToFile
public void saveToFile(@NonNull @NonNull String path, @NonNull @NonNull String fileName, boolean withTimes) Stores the entire data content in the given output file.- Parameters:
path
- The optional path string. Passing an empty string it is ignored.fileName
- The name of the output file.withTimes
- Iftrue
time description is saved. Only absolute time is saved iffalse
.
-
saveToFile
public void saveToFile(@NonNull @NonNull String path, @NonNull @NonNull String fileName, boolean withTimes, char separator) Stores the entire data content in the given output file.- Parameters:
path
- The optional path string. Passing an empty string it is ignored.fileName
- The name of the output file.withTimes
- Iftrue
time description is saved. Only absolute time is saved iffalse
.separator
- The character used to separate data.
-
onEvent
Performs one of the defined actions.- Specified by:
onEvent
in interfaceEventListener
- Parameters:
type
- aCommonEventType
object.- Throws:
NullPointerException
- whentype
isnull
.
-