Package de.gsi.dataset.spi
Class MultiDimDoubleDataSet
- java.lang.Object
-
- de.gsi.dataset.spi.AbstractStylable<D>
-
- de.gsi.dataset.spi.AbstractDataSet<MultiDimDoubleDataSet>
-
- de.gsi.dataset.spi.MultiDimDoubleDataSet
-
- All Implemented Interfaces:
DataSet,DataSetMetaData,EditableDataSet,EventSource,java.io.Serializable
public class MultiDimDoubleDataSet extends AbstractDataSet<MultiDimDoubleDataSet> implements EditableDataSet
Implementation of theDataSetinterface which stores x,y,... values in nDim separate arrays. It provides methods allowing easy manipulation of data points.- Author:
- rstein, akrimm
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected it.unimi.dsi.fastutil.doubles.DoubleArrayList[]values-
Fields inherited from class de.gsi.dataset.spi.AbstractDataSet
axisListener, dimension
-
Fields inherited from interface de.gsi.dataset.DataSetMetaData
TAG_GAIN_RANGE, TAG_OVERSHOOT, TAG_UNDERSHOOT
-
-
Constructor Summary
Constructors Constructor Description MultiDimDoubleDataSet(DataSet another)Creates a new instance ofMultiDimDoubleDataSetas copy of another (deep-copy).MultiDimDoubleDataSet(java.lang.String name, boolean deepCopy, double[]... values)Creates a new instance ofMultiDimDoubleDataSet.MultiDimDoubleDataSet(java.lang.String name, int nDim)Creates a new instance ofMultiDimDoubleDataSet.MultiDimDoubleDataSet(java.lang.String name, int nDims, int initialSize)Creates a new instance ofMultiDimDoubleDataSet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiDimDoubleDataSetadd(double... newValues)Add point to the end of the data setMultiDimDoubleDataSetadd(double[][] valuesNew)Add array vectors to data set.MultiDimDoubleDataSetadd(double[] newValues, java.lang.String label)Add point to the data set.MultiDimDoubleDataSetadd(int index, double... newValues)add point to the data setMultiDimDoubleDataSetadd(int index, double[][] newValues)add point to the data setMultiDimDoubleDataSetadd(int index, double[] newValues, java.lang.String label)add point to the data setMultiDimDoubleDataSetclearData()clear all data pointsdoubleget(int dimIndex, int index)Gets the x value of the data point with the index iintgetCapacity()intgetDataCount()Get the number of data points in the data set.doublegetValue(int dimIndex, double x)double[]getValues(int dimIndex)MultiDimDoubleDataSetincreaseCapacity(int amount)EditableDataSetremove(int index)remove point from data setMultiDimDoubleDataSetremove(int fromIndex, int toIndex)removes sub-range of data pointsMultiDimDoubleDataSetresize(int size)ensures minimum size, enlarges if necessaryMultiDimDoubleDataSetset(double[][] values)Initialises the data set with specified data.MultiDimDoubleDataSetset(double[][] values, boolean copy)Initialises the data set with specified data.MultiDimDoubleDataSetset(int index, double... newValue)replaces point coordinate of existing data pointMultiDimDoubleDataSetset(int index, double[][] values)Sets the values of the DataSet from index onwards.MultiDimDoubleDataSetset(DataSet other, boolean copy)clear old data and overwrite with data from 'other' data set (deep copy)MultiDimDoubleDataSetsetValues(int dimIndex, double[] values, boolean copy)Update the data for a given dimensionMultiDimDoubleDataSettrim()Trims the arrays list so that the capacity is equal to the size.-
Methods inherited from class de.gsi.dataset.spi.AbstractDataSet
addDataLabel, addDataStyle, autoNotification, binarySearch, binarySearch, clearMetaInfo, copyAxisDescription, copyDataLabelsAndStyles, copyMetaData, equalDataLabels, equalEditConstraints, equalErrorValues, equalMetaData, equals, equals, equalValues, fireInvalidated, getAxisDescriptions, getDataLabel, getDataLabelMap, getDataStyleMap, getDimension, getEditConstraints, getErrorList, getIndex, getInfoList, getMetaInfo, getName, getStyle, getThis, getValue, getWarningList, hashCode, lock, recomputeLimits, 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, getDataLabel, getDimension, getIndex, getName, getStyle, getStyle, getValue, lock, recomputeLimits, set, setStyle
-
Methods inherited from interface de.gsi.dataset.EditableDataSet
getEditConstraints, setEditConstraints, setName
-
Methods inherited from interface de.gsi.dataset.event.EventSource
addListener, autoNotification, invokeListener, invokeListener, invokeListener, isAutoNotification, removeListener, updateEventListener
-
-
-
-
Constructor Detail
-
MultiDimDoubleDataSet
public MultiDimDoubleDataSet(DataSet another)
Creates a new instance ofMultiDimDoubleDataSetas copy of another (deep-copy).- Parameters:
another- another Dataset to copy the content from
-
MultiDimDoubleDataSet
public MultiDimDoubleDataSet(java.lang.String name, int nDim)Creates a new instance ofMultiDimDoubleDataSet.- Parameters:
name- name of this DataSet.nDim- the number of dimensions- Throws:
java.lang.IllegalArgumentException- ifnameisnull
-
MultiDimDoubleDataSet
public MultiDimDoubleDataSet(java.lang.String name, boolean deepCopy, double[]... values)Creates a new instance of
The user can specify via the copy parameter, whether the dataset wraps the input arrays themselves or on a copies of the input arrays.MultiDimDoubleDataSet.- Parameters:
name- name of this data set.deepCopy- if true, the input array is copiedvalues- the values for the new dataset double[nDims][nDataPoints]- Throws:
java.lang.IllegalArgumentException- if any of the parameters isnullor if arrays with coordinates have different lengths
-
MultiDimDoubleDataSet
public MultiDimDoubleDataSet(java.lang.String name, int nDims, int initialSize)Creates a new instance ofMultiDimDoubleDataSet.- Parameters:
name- name of this DataSet.nDims- the number of dimensionsinitialSize- initial size of the dataset- Throws:
java.lang.IllegalArgumentException- ifnameisnull
-
-
Method Detail
-
add
public MultiDimDoubleDataSet add(double... newValues)
Add point to the end of the data set- Parameters:
newValues- the coordinate of the new value- Returns:
- itself
-
add
public MultiDimDoubleDataSet add(double[] newValues, java.lang.String label)
Add point to the data set.- Parameters:
newValues- the coordinate of the new valuelabel- the data label- Returns:
- itself (fluent design)
-
add
public MultiDimDoubleDataSet add(double[][] valuesNew)
Add array vectors to data set.- Parameters:
valuesNew- the coordinates of the new value- Returns:
- itself
-
add
public MultiDimDoubleDataSet add(int index, double... newValues)
add point to the data set- Specified by:
addin interfaceEditableDataSet- Parameters:
index- data point index at which the new data point should be addednewValues- the coordinates for the new point- Returns:
- itself (fluent design)
-
add
public MultiDimDoubleDataSet add(int index, double[] newValues, java.lang.String label)
add point to the data set- Parameters:
index- data point index at which the new data point should be addednewValues- coordinate of the new data pointlabel- data point label (see CategoryAxis)- Returns:
- itself (fluent design)
-
add
public MultiDimDoubleDataSet add(int index, double[][] newValues)
add point to the data set- Parameters:
index- data point index at which the new data points should be addednewValues- the coordinates of the new points- Returns:
- itself (fluent design)
-
clearData
public MultiDimDoubleDataSet clearData()
clear all data points- Returns:
- itself (fluent design)
-
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
-
getCapacity
public int getCapacity()
- Returns:
- storage capacity of dataset
-
getValues
public final double[] getValues(int dimIndex)
- Specified by:
getValuesin interfaceDataSet- Overrides:
getValuesin classAbstractDataSet<MultiDimDoubleDataSet>- Parameters:
dimIndex- the dimension index (ie. '0' equals 'X', '1' equals 'Y')- Returns:
- the x value array
-
increaseCapacity
public MultiDimDoubleDataSet increaseCapacity(int amount)
- Parameters:
amount- storage capacity increase- Returns:
- itself (fluent design)
-
remove
public EditableDataSet remove(int index)
remove point from data set- Specified by:
removein interfaceEditableDataSet- Parameters:
index- data point which should be removed- Returns:
- itself (fluent design)
-
remove
public MultiDimDoubleDataSet remove(int fromIndex, int toIndex)
removes sub-range of data points- Parameters:
fromIndex- start index (inclusive)toIndex- stop index (exclusive)- Returns:
- itself (fluent design)
-
resize
public MultiDimDoubleDataSet resize(int size)
ensures minimum size, enlarges if necessary- Parameters:
size- the actually used array lengths- Returns:
- itself (fluent design)
-
set
public MultiDimDoubleDataSet set(DataSet other, boolean copy)
clear old data and overwrite with data from 'other' data set (deep copy)
-
set
public MultiDimDoubleDataSet set(double[][] values)
Initialises the data set with specified data.
Note: The method copies values from specified double arrays.- Parameters:
values- coordinates- Returns:
- itself
-
set
public MultiDimDoubleDataSet set(double[][] values, boolean copy)
Initialises the data set with specified data.
Note: The method copies values from specified double arrays.- Parameters:
values- coordinatescopy- true: makes an internal copy, false: use the pointer as is (saves memory allocation- Returns:
- itself
-
setValues
public MultiDimDoubleDataSet setValues(int dimIndex, double[] values, boolean copy)
Update the data for a given dimension
- Parameters:
dimIndex- dimension index (e.g. DataSet.DIM_X)values- values for dimensioncopy- true: makes an internal copy, false: use the pointer as is (saves memory allocation- Returns:
- itself
-
set
public MultiDimDoubleDataSet set(int index, double... newValue)
replaces point coordinate of existing data point- Specified by:
setin interfaceEditableDataSet- Parameters:
index- data point index at which the new data point should be addednewValue- new data point coordinate- Returns:
- itself (fluent design)
-
set
public MultiDimDoubleDataSet set(int index, double[][] values)
Sets the values of the DataSet from index onwards. Clears all labels in the overwritten section of data.- Parameters:
index- start index of the datavalues- coordinates for the new points- Returns:
- itself
-
trim
public MultiDimDoubleDataSet trim()
Trims the arrays list so that the capacity is equal to the size.- Returns:
- itself (fluent design)
- See Also:
ArrayList.trimToSize()
-
getDataCount
public int getDataCount()
Description copied from interface:DataSetGet the number of data points in the data set.- Specified by:
getDataCountin interfaceDataSet- Returns:
- the number of data points
-
getValue
public double getValue(int dimIndex, double x)
-
-