AnyLogic
Expand
Font size
All Implemented Interfaces:
Serializable

public class DataSet
extends BasicDataSet
A data set capable of storing 2D (X,Y) data of type double and maintaining the up-to-date minimum and maximum of the stored data for each dimension. The data set keeps a given limited number of the latest data items.
Please note that adding a new item when the dataset is full will cause loss of the oldest sample and, if the lost item contained minimum or maximum, will initiate a new search for min/max, which may be quite time consuming for large datasets. Therefore for large datasets it is recommended to have the size not less than the number of items yoiu plan to add.
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Constructor Summary

ConstructorDescription
DataSet(int capacity)
Constructs a 2D data set with data of type double with a given capacity.
DataSet(int capacity, DataUpdater_xjal updater)
Constructs a 2D data set with data of type double with a given capacity.
Registers the given updater so that dataset uses it while being updated.

Method Summary

Modifier and TypeMethodDescription
voidadd(double x, double y)
Adds a new data item to the data set.
voidadd(double x, IStatechartState<?,?> state)
Adds a new statechart state data item to the data set.
voidfillFrom(BasicDataSet ds)
Makes this dataset an exact copy of the given original dataset.
voidfillFrom(TableFunction tf)
Discards all existing data, sets the capacity to equal to the number of entries in the given table function and fills the dataset from the given table function.
StringgetSVGDeltaAndMarkSynced(boolean deltaonly) 
voidreset()
Discards all stored data and their minimum/maximum.
voidsetCapacity(int newcapacity)
Resizes the data set according to the new capacity.

Methods inherited from class com.anylogic.engine.analysis.ChartItem

getVersion

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Details

DataSet

public DataSet(int capacity)
Constructs a 2D data set with data of type double with a given capacity.
Parameters:
capacity - the maximum number of (x,y) items the data set can store

DataSet

public DataSet(int capacity,
 DataUpdater_xjal updater)
Constructs a 2D data set with data of type double with a given capacity.
Registers the given updater so that dataset uses it while being updated. Updater may be BasicDataSet.destroyUpdater_xjal() dropped off when no more needed, in order to improve memory performance.
Parameters:
capacity - the maximum number of (x,y) items the data set can store
updater - updater which may be used instead of overriding BasicDataSet.update() method

Method Details

add

public void add(double x,
 IStatechartState<?,?> state)
Adds a new statechart state data item to the data set. If the data set is full, the oldest item will be pushed out and lost. The minimum/maximum may change as a result of both adding new and discarding old values and are recalculated.
Parameters:
x - the x value of the data item, usually time
state - the y value of the data item, the state (ordinal number of the state will be used)

fillFrom

public void fillFrom(TableFunction tf)
Discards all existing data, sets the capacity to equal to the number of entries in the given table function and fills the dataset from the given table function.
Overrides:
fillFrom in class BasicDataSet
Parameters:
tf - the table function to copy data from

reset

public void reset()
Discards all stored data and their minimum/maximum.
Overrides:
reset in class BasicDataSet

setCapacity

public void setCapacity(int newcapacity)
Resizes the data set according to the new capacity. As many as possible of old data items will be kept. The minimum/maximum are recalculated.
Overrides:
setCapacity in class BasicDataSet
Parameters:
newcapacity - the new size of the data set

add

public void add(double x,
 double y)
Adds a new data item to the data set. If the data set is full, the oldest item will be pushed out and lost. The minimum/maximum may change as a result of both adding new and discarding old values and are recalculated.
Overrides:
add in class BasicDataSet
Parameters:
x - the x value of the data item
y - the y value of the data item

fillFrom

public void fillFrom(BasicDataSet ds)
Makes this dataset an exact copy of the given original dataset.
Overrides:
fillFrom in class BasicDataSet
Parameters:
ds - the original dataset

getSVGDeltaAndMarkSynced

@AnyLogicInternalAPI
public String getSVGDeltaAndMarkSynced(boolean deltaonly)