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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new series to the existing one.voidaddSeries(@NonNull DoubleSource source, @NonNull Enum<?> valueID) Adds a new series to the existing one.voidAdds a new series to the existing one.voidaddSeries(@NonNull LongSource source, @NonNull Enum<?> valueID) Adds a new series to the existing one.voidAdds a new series to the existing one.getSeries(int seriesIndex) Returns a series at the given index.intReturns the number of series.voidPerforms one of the defined actions.voidStores the entire data content in the output file in the same directory.voidsaveToFile(@NonNull String path, @NonNull String fileName) Stores the entire data content in the given output file.voidsaveToFile(@NonNull String path, @NonNull String fileName, boolean withTimes) Stores the entire data content in the given output file.voidsaveToFile(@NonNull String path, @NonNull String fileName, boolean withTimes, char separator) Stores the entire data content in the given output file.voidUpdates 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- whenaSeriesisnull.
-
addSeries
Adds a new series to the existing one.- Parameters:
source- ADoubleSourceobject.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- TheIntSourceobject.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:
updateSourcein interfaceUpdatableSource
-
getSeries
Returns a series at the given index.- Parameters:
seriesIndex- The name of the series.- Returns:
- The asked series or
nullif series does not exist. - Throws:
IndexOutOfBoundsException- IfseriesIndexis 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- Iftruetime 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- Iftruetime 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:
onEventin interfaceEventListener- Parameters:
type- aCommonEventTypeobject.- Throws:
NullPointerException- whentypeisnull.
-