Package de.gsi.dataset.spi
Class AbstractDataSet<D extends AbstractStylable<D>>
- java.lang.Object
-
- de.gsi.dataset.spi.AbstractStylable<D>
-
- de.gsi.dataset.spi.AbstractDataSet<D>
-
- Type Parameters:
D- java generics handling of DataSet for derived classes (needed for fluent design)
- All Implemented Interfaces:
DataSet,DataSetMetaData,EventSource,java.io.Serializable
- Direct Known Subclasses:
AbstractErrorDataSet,AbstractGridDataSet,AbstractHistogram,AveragingDataSet,DoubleDataSet,FloatDataSet,FragmentedDataSet,LabelledMarkerDataSet,MultiDimDoubleDataSet,WrappedDataSet
public abstract class AbstractDataSet<D extends AbstractStylable<D>> extends AbstractStylable<D> implements DataSet, DataSetMetaData
The abstract implementation of DataSet interface that provides implementation of some methods.
- It maintains the name of the DataSet
- It maintains a list of DataSetListener objects and provides methods that can be used to dispatch DataSetEvent events.
- It maintains ranges for all dimensions of the DataSet.
- It maintains the names and units for the axes
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected EventListeneraxisListenerprotected intdimension-
Fields inherited from interface de.gsi.dataset.DataSetMetaData
TAG_GAIN_RANGE, TAG_OVERSHOOT, TAG_UNDERSHOOT
-
-
Constructor Summary
Constructors Constructor Description AbstractDataSet(java.lang.String name, int dimension)default constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringaddDataLabel(int index, java.lang.String label)adds a custom new data label for a point The label can be used as a category name if CategoryStepsDefinition is used or for annotations displayed for data points.java.lang.StringaddDataStyle(int index, java.lang.String style)A string representation of the CSS style associated with this specificDataSetdata point.java.util.concurrent.atomic.AtomicBooleanautoNotification()Set the automatic notification of invalidation listeners.static intbinarySearch(double search, int indexMin, int indexMax, java.util.function.IntToDoubleFunction getter)protected intbinarySearch(int dimIndex, double search, int indexMin, int indexMax)DclearMetaInfo()protected voidcopyAxisDescription(DataSet other)protected voidcopyDataLabelsAndStyles(DataSet other, boolean copy)protected booleancopyMetaData(DataSet other)protected booleanequalDataLabels(DataSet other)checks for equal data labels, may be overwritten by derived classesprotected booleanequalEditConstraints(DataSet other)checks for equal EditConstraints, may be overwritten by derived classesprotected booleanequalErrorValues(DataSet other, double epsilon)checks for equal 'get' error values, may be overwritten by derived classesprotected booleanequalMetaData(DataSet other)checks for equal meta data, may be overwritten by derived classesbooleanequals(java.lang.Object obj)booleanequals(java.lang.Object obj, double epsilon)Indicates whether some other object is "equal to" this one.protected booleanequalValues(DataSet other, double epsilon)checks for equal 'get' values with tolerance band, may be overwritten by derived classesDfireInvalidated(UpdateEvent event)Notifies listeners that the data has been invalidated.java.util.List<AxisDescription>getAxisDescriptions()java.lang.StringgetDataLabel(int index)Returns label of a data point specified by the index.StringHashMapListgetDataLabelMap()StringHashMapListgetDataStyleMap()intgetDimension()EditConstraintsgetEditConstraints()java.util.List<java.lang.String>getErrorList()intgetIndex(int dimIndex, double... x)Gets the index of the data point closest to the given 'value' coordinate.java.util.List<java.lang.String>getInfoList()java.util.Map<java.lang.String,java.lang.String>getMetaInfo()java.lang.StringgetName()Gets the name of the data set.java.lang.StringgetStyle(int index)A string representation of the CSS style associated with this specificDataSetdata point.protected DgetThis()doublegetValue(int dimIndex, double... x)Returns the value along the 'dimIndex' axis of a point specified by thexcoordinate.double[]getValues(int dimIndex)java.util.List<java.lang.String>getWarningList()inthashCode()DataSetLock<? extends DataSet>lock()DataSetrecomputeLimits(int dimIndex)java.lang.StringremoveDataLabel(int index)remove a custom data label for a point The label can be used as a category name if CategoryStepsDefinition is used or for annotations displayed for data points.java.lang.StringremoveStyle(int index)A string representation of the CSS style associated with this specificDataSetdata point.DsetEditConstraints(EditConstraints constraints)DsetName(java.lang.String name)Sets the name of data set (meta data)java.lang.StringtoString()java.util.List<EventListener>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
get, getAxisDescription, getDataCount, getStyle, set, set, setStyle
-
Methods inherited from interface de.gsi.dataset.event.EventSource
addListener, invokeListener, invokeListener, invokeListener, isAutoNotification, removeListener
-
-
-
-
Field Detail
-
dimension
protected int dimension
-
axisListener
protected final transient EventListener axisListener
-
-
Method Detail
-
addDataLabel
public java.lang.String addDataLabel(int index, java.lang.String label)adds a custom new data label for a point The label can be used as a category name if CategoryStepsDefinition is used or for annotations displayed for data points.- Parameters:
index- of the data pointlabel- for the data point specified by the index- Returns:
- the previously set label or
nullif no label has been specified
-
addDataStyle
public java.lang.String addDataStyle(int index, java.lang.String style)A string representation of the CSS style associated with this specificDataSetdata point. @see #getStyle()- Parameters:
index- the index of the specific data pointstyle- string for the data point specific CSS-styling- Returns:
- itself (fluent interface)
-
autoNotification
public java.util.concurrent.atomic.AtomicBoolean autoNotification()
Description copied from interface:EventSourceSet the automatic notification of invalidation listeners. In general, data sets should notify registered invalidation listeners, if the data in the data set has changed. Charts usually register an invalidation listener with the data set to be notified of any changes and update the charts. Setting the automatic notification to false, allows applications to prevent this behaviour, in case data sets are updated multiple times during an acquisition cycle but the chart update is only required at the end of the cycle.truefor automatic notification- Specified by:
autoNotificationin interfaceEventSource- Returns:
- the atomic boolean
-
binarySearch
protected int binarySearch(int dimIndex, double search, int indexMin, int indexMax)
-
clearMetaInfo
public D clearMetaInfo()
-
equalDataLabels
protected boolean equalDataLabels(DataSet other)
checks for equal data labels, may be overwritten by derived classes- Parameters:
other- class- Returns:
trueif equal
-
equalEditConstraints
protected boolean equalEditConstraints(DataSet other)
checks for equal EditConstraints, may be overwritten by derived classes- Parameters:
other- class- Returns:
trueif equal
-
equalErrorValues
protected boolean equalErrorValues(DataSet other, double epsilon)
checks for equal 'get' error values, may be overwritten by derived classes- Parameters:
other- classepsilon- tolerance threshold- Returns:
trueif equal
-
equalMetaData
protected boolean equalMetaData(DataSet other)
checks for equal meta data, may be overwritten by derived classes- Parameters:
other- class- Returns:
trueif equal
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj, double epsilon)Indicates whether some other object is "equal to" this one.- Parameters:
obj- the reference object with which to compare.epsilon- tolerance parameter (epsilon<=0corresponds to numerically identical)- Returns:
trueif this object is the same as the obj argument;falseotherwise.
-
equalValues
protected boolean equalValues(DataSet other, double epsilon)
checks for equal 'get' values with tolerance band, may be overwritten by derived classes- Parameters:
other- classepsilon- tolerance threshold- Returns:
trueif equal
-
fireInvalidated
public D fireInvalidated(UpdateEvent event)
Notifies listeners that the data has been invalidated. If the data is added to the chart, it triggers repaint.- Parameters:
event- the change event- Returns:
- itself (fluent design)
-
getAxisDescriptions
public java.util.List<AxisDescription> getAxisDescriptions()
- Specified by:
getAxisDescriptionsin interfaceDataSet- Returns:
- axis descriptions of the primary and secondary axes
-
getDataLabel
public java.lang.String getDataLabel(int index)
Returns 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- Parameters:
index- of the data label- Returns:
- data point label specified by the index or
nullif no label has been specified
-
getDataLabelMap
public StringHashMapList getDataLabelMap()
- Returns:
- data label map for given data point
-
getDataStyleMap
public StringHashMapList getDataStyleMap()
- Returns:
- data style map (CSS-styling)
-
getDimension
public final int getDimension()
- Specified by:
getDimensionin interfaceDataSet- Returns:
- number of dimensions
-
getEditConstraints
public EditConstraints getEditConstraints()
-
getErrorList
public java.util.List<java.lang.String> getErrorList()
- Specified by:
getErrorListin interfaceDataSetMetaData
-
getInfoList
public java.util.List<java.lang.String> getInfoList()
- Specified by:
getInfoListin interfaceDataSetMetaData
-
getMetaInfo
public java.util.Map<java.lang.String,java.lang.String> getMetaInfo()
- Specified by:
getMetaInfoin interfaceDataSetMetaData
-
getName
public java.lang.String getName()
Description copied from interface:DataSetGets the name of the data set.
-
getStyle
public java.lang.String getStyle(int index)
A string representation of the CSS style associated with this specificDataSetdata point. @see #getStyle()
-
getThis
protected D getThis()
- Overrides:
getThisin classAbstractStylable<D extends AbstractStylable<D>>
-
getWarningList
public java.util.List<java.lang.String> getWarningList()
- Specified by:
getWarningListin interfaceDataSetMetaData
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
lock
public DataSetLock<? extends DataSet> lock()
- Specified by:
lockin interfaceDataSet- Returns:
- Read-Write Lock to guard the DataSet
- See Also:
DataSetLock
-
removeDataLabel
public java.lang.String removeDataLabel(int index)
remove a custom data label for a point The label can be used as a category name if CategoryStepsDefinition is used or for annotations displayed for data points.- Parameters:
index- of the data point- Returns:
- the previously set label or
nullif no label has been specified
-
removeStyle
public java.lang.String removeStyle(int index)
A string representation of the CSS style associated with this specificDataSetdata point. @see #getStyle()- Parameters:
index- the index of the specific data point- Returns:
- itself (fluent interface)
-
setEditConstraints
public D setEditConstraints(EditConstraints constraints)
-
setName
public D setName(java.lang.String name)
Sets the name of data set (meta data)- Parameters:
name- the new name- Returns:
- itself (fluent design)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getValues
public double[] getValues(int dimIndex)
-
getValue
public double getValue(int dimIndex, double... x)Description copied from interface:DataSetReturns the value along the 'dimIndex' axis of a point specified by thexcoordinate.
-
binarySearch
public static int binarySearch(double search, int indexMin, int indexMax, java.util.function.IntToDoubleFunction getter)
-
getIndex
public int getIndex(int dimIndex, double... x)Description copied from interface:DataSetGets the index of the data point closest to the given 'value' coordinate. The index returned may be less then zero or larger the the number of data points in the data set, if the x coordinate lies outside the range of the data set.
-
recomputeLimits
public DataSet recomputeLimits(int dimIndex)
- Specified by:
recomputeLimitsin interfaceDataSet- Parameters:
dimIndex- the dimension to recompute the range for (-1 for all dimensions)- Returns:
- itself for method chaining
-
updateEventListener
public java.util.List<EventListener> updateEventListener()
- Specified by:
updateEventListenerin interfaceEventSource- Returns:
- list containing all update event listener (needs to be provided by implementing class)
-
copyMetaData
protected boolean copyMetaData(DataSet other)
-
copyDataLabelsAndStyles
protected void copyDataLabelsAndStyles(DataSet other, boolean copy)
-
copyAxisDescription
protected void copyAxisDescription(DataSet other)
-
-