Package de.gsi.dataset.spi
Class FifoDoubleErrorDataSet
- java.lang.Object
-
- de.gsi.dataset.spi.AbstractStylable<D>
-
- de.gsi.dataset.spi.AbstractDataSet<D>
-
- de.gsi.dataset.spi.AbstractErrorDataSet<DoubleErrorDataSet>
-
- de.gsi.dataset.spi.FifoDoubleErrorDataSet
-
- All Implemented Interfaces:
DataSet,DataSet2D,DataSetError,DataSetMetaData,EventSource,java.io.Serializable
public class FifoDoubleErrorDataSet extends AbstractErrorDataSet<DoubleErrorDataSet> implements DataSet2D, DataSetError
Limited Fifo DoubleErrorDataSet. Maximum number of samples and maximum horizontal span are configurable- Author:
- rstein
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classFifoDoubleErrorDataSet.DataBlob-
Nested classes/interfaces inherited from interface de.gsi.dataset.DataSetError
DataSetError.ErrorType
-
-
Field Summary
Fields Modifier and Type Field Description protected LimitedQueue<FifoDoubleErrorDataSet.DataBlob>dataprotected doublemaxDistance-
Fields inherited from interface de.gsi.dataset.DataSetMetaData
TAG_GAIN_RANGE, TAG_OVERSHOOT, TAG_UNDERSHOOT
-
-
Constructor Summary
Constructors Constructor Description FifoDoubleErrorDataSet(java.lang.String name, int initalSize)Creates a new instance ofFifoDoubleErrorDataSet.FifoDoubleErrorDataSet(java.lang.String name, int initalSize, double maxDistance)Creates a new instance ofFifoDoubleErrorDataSet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FifoDoubleErrorDataSetadd(double[] xValues, double[] yValues, double[] yErrorsNeg, double[] yErrorsPos)Initialises the data set with specified data.FifoDoubleErrorDataSetadd(double x, double y, double yErrorNeg, double yErrorPos)Add point to the DoublePoints objectFifoDoubleErrorDataSetadd(double x, double y, double yErrorNeg, double yErrorPos, java.lang.String tag)Add point to the DoublePoints objectFifoDoubleErrorDataSetadd(double x, double y, double yErrorNeg, double yErrorPos, java.lang.String tag, java.lang.String style)Add point to the DoublePoints objectintexpire(double now)expire data points that are older than now minus length of the buffer, notifies a 'fireInvalidated()' in case data has been removeddoubleget(int dimIndex, int index)Gets the x value of the data point with the index iLimitedQueue<FifoDoubleErrorDataSet.DataBlob>getData()intgetDataCount(int dimIndex)Get the number of data points in the data set for a specific dimension.java.lang.StringgetDataLabel(int index)Returns label of a data point specified by the index.doublegetErrorNegative(int dimIndex, int index)Returns the negative error along the 'dimIndex' axis of a point specified by theindex.doublegetErrorPositive(int dimIndex, int index)Returns the positive error along the 'dimIndex' axis of a point specified by theindex.doublegetMaxDistance()java.lang.StringgetStyle(int index)A string representation of the CSS style associated with this specificDataSetdata point.voidreset()remove all data pointsvoidsetMaxDistance(double maxDistance)-
Methods inherited from class de.gsi.dataset.spi.AbstractErrorDataSet
fireInvalidated, getErrorType, getThis, lock, recomputeLimits, setErrorType
-
Methods inherited from class de.gsi.dataset.spi.AbstractDataSet
addDataLabel, addDataStyle, autoNotification, binarySearch, clearMetaInfo, equalDataLabels, equalEditConstraints, equalErrorValues, equalMetaData, equals, equals, equalValues, getAxisDescriptions, getDataLabelMap, getDataStyleMap, getDimension, getEditConstraints, getErrorList, getIndex, getInfoList, getMetaInfo, getName, getWarningList, hashCode, minNeigbourSearchX, removeDataLabel, removeStyle, setEditConstraints, setName, toString, updateEventListener
-
Methods inherited from class de.gsi.dataset.spi.AbstractStylable
getStyle, setStyle
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.gsi.dataset.DataSet
getAxisDescription, getAxisDescriptions, getDataCount, getIndex, getName, getStyle, getValues, lock, recomputeLimits, setStyle
-
Methods inherited from interface de.gsi.dataset.DataSet2D
getDimension, getValue, getValue, getX, getXIndex, getXValues, getY, getYIndex, getYValues
-
Methods inherited from interface de.gsi.dataset.DataSetError
getErrorNegative, getErrorPositive, getErrorsNegative, getErrorsPositive, getErrorType
-
Methods inherited from interface de.gsi.dataset.event.EventSource
addListener, autoNotification, invokeListener, invokeListener, invokeListener, isAutoNotification, removeListener, updateEventListener
-
-
-
-
Field Detail
-
data
protected final LimitedQueue<FifoDoubleErrorDataSet.DataBlob> data
-
maxDistance
protected double maxDistance
-
-
Constructor Detail
-
FifoDoubleErrorDataSet
public FifoDoubleErrorDataSet(java.lang.String name, int initalSize)Creates a new instance ofFifoDoubleErrorDataSet.- Parameters:
name- name of this DataSet.initalSize- maximum circular buffer capacity- Throws:
java.lang.IllegalArgumentException- ifnameisnull
-
FifoDoubleErrorDataSet
public FifoDoubleErrorDataSet(java.lang.String name, int initalSize, double maxDistance)Creates a new instance ofFifoDoubleErrorDataSet.- Parameters:
name- name of this DataSet.initalSize- maximum circular buffer capacitymaxDistance- maximum range before data points are being dropped- Throws:
java.lang.IllegalArgumentException- ifnameisnull
-
-
Method Detail
-
add
public FifoDoubleErrorDataSet add(double x, double y, double yErrorNeg, double yErrorPos)
Add point to the DoublePoints object- Parameters:
x- the new x coordinatey- the new y coordinateyErrorNeg- the -dy erroryErrorPos- the +dy error- Returns:
- itself
-
add
public FifoDoubleErrorDataSet add(double x, double y, double yErrorNeg, double yErrorPos, java.lang.String tag)
Add point to the DoublePoints object- Parameters:
x- the new x coordinatey- the new y coordinateyErrorNeg- the -dy erroryErrorPos- the +dy errortag- the data tag- Returns:
- itself
-
add
public FifoDoubleErrorDataSet add(double x, double y, double yErrorNeg, double yErrorPos, java.lang.String tag, java.lang.String style)
Add point to the DoublePoints object- Parameters:
x- the new x coordinatey- the new y coordinateyErrorNeg- the -dy erroryErrorPos- the +dy errortag- the data tagstyle- the data point style- Returns:
- itself
-
add
public FifoDoubleErrorDataSet add(double[] xValues, double[] yValues, double[] yErrorsNeg, double[] yErrorsPos)
Initialises the data set with specified data.
Note: The method copies values from specified double arrays.- Parameters:
xValues- the new x coordinatesyValues- the new y coordinatesyErrorsNeg- the -dy errorsyErrorsPos- the +dy errors- Returns:
- itself
-
expire
public int expire(double now)
expire data points that are older than now minus length of the buffer, notifies a 'fireInvalidated()' in case data has been removed- Parameters:
now- the newest time-stamp- Returns:
- number of items that have been removed
-
get
public final double get(int dimIndex, int index)Description copied from interface:DataSetGets the x value of the data point with the index i
-
getData
public LimitedQueue<FifoDoubleErrorDataSet.DataBlob> getData()
- Returns:
- the internal data container (N.B. this is not thread-safe)
-
getDataCount
public int getDataCount(int dimIndex)
Description copied from interface:DataSetGet the number of data points in the data set for a specific dimension.- Specified by:
getDataCountin interfaceDataSet- Parameters:
dimIndex- the dimension index (ie. '0' equals 'X', '1' equals 'Y')- Returns:
- the number of data points
-
getDataLabel
public java.lang.String getDataLabel(int index)
Description copied from class:AbstractDataSetReturns label of a data point specified by the index. The label can be used as a category name if CategoryStepsDefinition is used or for annotations displayed for data points.- Specified by:
getDataLabelin interfaceDataSet- Overrides:
getDataLabelin classAbstractDataSet<DoubleErrorDataSet>- Parameters:
index- of the data label- Returns:
- data point label specified by the index or
nullif no label has been specified
-
getErrorNegative
public double getErrorNegative(int dimIndex, int index)Description copied from interface:DataSetErrorReturns the negative error along the 'dimIndex' axis of a point specified by theindex. Please note that errors are assumed to be always positive!- Specified by:
getErrorNegativein interfaceDataSetError- Parameters:
dimIndex- the dimension index (ie. '0' equals 'X', '1' equals 'Y')index- of negative 'dimIndex' error to be returned.- Returns:
- negative 'dimIndex' error
-
getErrorPositive
public double getErrorPositive(int dimIndex, int index)Description copied from interface:DataSetErrorReturns the positive error along the 'dimIndex' axis of a point specified by theindex. Please note that errors are assumed to be always positive!- Specified by:
getErrorPositivein interfaceDataSetError- Parameters:
dimIndex- the dimension index (ie. '0' equals 'X', '1' equals 'Y')index- of positive 'dimIndex' error to be returned.- Returns:
- positive 'dimIndex' error
-
getMaxDistance
public double getMaxDistance()
- Returns:
- maximum range before data points are being dropped
-
getStyle
public java.lang.String getStyle(int index)
Description copied from class:AbstractDataSetA string representation of the CSS style associated with this specificDataSetdata point. @see #getStyle()- Specified by:
getStylein interfaceDataSet- Overrides:
getStylein classAbstractDataSet<DoubleErrorDataSet>- Parameters:
index- the index of the specific data point- Returns:
- user-specific data set style description (ie. may be set by user)
-
reset
public void reset()
remove all data points
-
setMaxDistance
public void setMaxDistance(double maxDistance)
- Parameters:
maxDistance- maximum range before data points are being dropped
-
-