Package jisa.gui.plotting
Class TwoErrorDataSet
- java.lang.Object
-
- de.gsi.dataset.spi.AbstractStylable<D>
-
- de.gsi.dataset.spi.AbstractDataSet<D>
-
- de.gsi.dataset.spi.AbstractErrorDataSet<TwoErrorDataSet>
-
- jisa.gui.plotting.TwoErrorDataSet
-
- All Implemented Interfaces:
de.gsi.dataset.DataSet,de.gsi.dataset.DataSet2D,de.gsi.dataset.DataSetError,de.gsi.dataset.DataSetMetaData,de.gsi.dataset.EditableDataSet,de.gsi.dataset.event.EventSource,java.io.Serializable
- Direct Known Subclasses:
JISAErrorDataSet
public class TwoErrorDataSet extends de.gsi.dataset.spi.AbstractErrorDataSet<TwoErrorDataSet> implements de.gsi.dataset.DataSet2D, de.gsi.dataset.DataSetError, de.gsi.dataset.EditableDataSet
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected it.unimi.dsi.fastutil.doubles.DoubleArrayListxErrorsNegprotected it.unimi.dsi.fastutil.doubles.DoubleArrayListxErrorsPosprotected it.unimi.dsi.fastutil.doubles.DoubleArrayListxValuesprotected it.unimi.dsi.fastutil.doubles.DoubleArrayListyErrorsNegprotected it.unimi.dsi.fastutil.doubles.DoubleArrayListyErrorsPosprotected it.unimi.dsi.fastutil.doubles.DoubleArrayListyValues
-
Constructor Summary
Constructors Constructor Description TwoErrorDataSet(de.gsi.dataset.DataSet another)Creates a new instance ofDoubleErrorDataSetas copy of another (deep-copy).TwoErrorDataSet(java.lang.String name)Creates a new instance ofDoubleErrorDataSet.TwoErrorDataSet(java.lang.String name, int initalSize)Creates a new instance ofDoubleErrorDataSet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TwoErrorDataSetadd(double[] xValuesNew, double[] yValuesNew, double[] yErrorsNegNew, double[] yErrorsPosNew, double[] xErrorsNegNew, double[] xErrorsPosNew)Add array vectors to data set.TwoErrorDataSetadd(double x, double y)add point to the data setTwoErrorDataSetadd(double x, double y, double yErrorNeg, double yErrorPos)Add point to the data set.TwoErrorDataSetadd(double x, double y, double yErrorNeg, double yErrorPos, double xErrorNeg, double xErrorPos)Add point to the data set.TwoErrorDataSetadd(double x, double y, double yErrorNeg, double yErrorPos, double xErrorNeg, double xErrorPos, java.lang.String label)Add point to the data set.TwoErrorDataSetadd(int index, double... newValue)add point to the data setTwoErrorDataSetadd(int index, double[] x, double[] y, double[] yErrorNeg, double[] yErrorPos)add point to the data setTwoErrorDataSetadd(int index, double x, double y)add point to the data setTwoErrorDataSetadd(int index, double x, double y, double yErrorNeg, double yErrorPos)add point to the data setTwoErrorDataSetadd(int index, double x, double y, double yErrorNeg, double yErrorPos, double xErrorNeg, double xErrorPos)add point to the data setTwoErrorDataSetadd(int index, double x, double y, double yErrorNeg, double yErrorPos, double xErrorNeg, double xErrorPos, java.lang.String label)add point to the data setTwoErrorDataSetclearData()clears all datadoubleget(int dimIndex, int index)intgetCapacity()intgetDataCount()doublegetErrorNegative(int dimIndex, int index)doublegetErrorPositive(int dimIndex, int index)double[]getErrorsNegative(int dimIndex)double[]getErrorsPositive(int dimIndex)de.gsi.dataset.DataSetError.ErrorTypegetErrorType(int dimIndex)double[]getValues(int dimIndex)TwoErrorDataSetincreaseCapacity(int amount)TwoErrorDataSetremove(int index)TwoErrorDataSetremove(int fromIndex, int toIndex)remove sub-range of data pointsTwoErrorDataSetresize(int size)ensures minimum size, enlarges if necessaryTwoErrorDataSetset(double[] xValues, double[] yValues, double[] yErrorsNeg, double[] yErrorsPos)Initialises the data set with specified data.TwoErrorDataSetset(double[] xValues, double[] yValues, double[] yErrorsNeg, double[] yErrorsPos, boolean copy)Initialises the data set with specified data.TwoErrorDataSetset(double[] xValues, double[] yValues, double[] yErrorsNeg, double[] yErrorsPos, int nSamples, boolean copy)Initialises the data set with specified data.TwoErrorDataSetset(int index, double... newValue)replaces point coordinate of existing data pointTwoErrorDataSetset(int index, double[] x, double[] y, double[] yErrorNeg, double[] yErrorPos)TwoErrorDataSetset(int index, double x, double y)replaces point coordinate of existing data pointTwoErrorDataSetset(int index, double x, double y, double yErrorNeg, double yErrorPos)replaces point coordinate of existing data pointTwoErrorDataSetset(de.gsi.dataset.DataSet other, boolean copy)clear old data and overwrite with data from 'other' data set (deep copy)TwoErrorDataSettrim()Trims the arrays list so that the capacity is equal to the size.-
Methods inherited from class de.gsi.dataset.spi.AbstractErrorDataSet
fireInvalidated, getThis, lock, recomputeLimits, setErrorType
-
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, getAxisDescriptions, getDataLabel, getDataLabelMap, getDataStyleMap, getDimension, getEditConstraints, getErrorList, getIndex, getInfoList, getMetaInfo, getName, getStyle, getValue, getWarningList, hashCode, isVisible, removeDataLabel, removeStyle, setEditConstraints, setName, setVisible, toString, updateEventListener
-
Methods inherited from interface de.gsi.dataset.DataSet
getAxisDescription, getAxisDescriptions, getDataLabel, getIndex, getName, getStyle, getStyle, getValue, isVisible, lock, recomputeLimits, set, setStyle, setVisible
-
Methods inherited from interface de.gsi.dataset.DataSet2D
getDimension, getValue, getX, getXIndex, getXValues, getY, getYIndex, getYValues
-
-
-
-
Field Detail
-
xValues
protected it.unimi.dsi.fastutil.doubles.DoubleArrayList xValues
-
yValues
protected it.unimi.dsi.fastutil.doubles.DoubleArrayList yValues
-
xErrorsPos
protected it.unimi.dsi.fastutil.doubles.DoubleArrayList xErrorsPos
-
xErrorsNeg
protected it.unimi.dsi.fastutil.doubles.DoubleArrayList xErrorsNeg
-
yErrorsPos
protected it.unimi.dsi.fastutil.doubles.DoubleArrayList yErrorsPos
-
yErrorsNeg
protected it.unimi.dsi.fastutil.doubles.DoubleArrayList yErrorsNeg
-
-
Constructor Detail
-
TwoErrorDataSet
public TwoErrorDataSet(de.gsi.dataset.DataSet another)
Creates a new instance ofDoubleErrorDataSetas copy of another (deep-copy).- Parameters:
another- name of this DataSet.
-
TwoErrorDataSet
public TwoErrorDataSet(java.lang.String name)
Creates a new instance ofDoubleErrorDataSet.- Parameters:
name- name of this DataSet.- Throws:
java.lang.IllegalArgumentException- ifnameisnull
-
TwoErrorDataSet
public TwoErrorDataSet(java.lang.String name, int initalSize)Creates a new instance ofDoubleErrorDataSet.- Parameters:
name- name of this DataSet.initalSize- initial capacity of buffer (N.B. size=0)- Throws:
java.lang.IllegalArgumentException- ifnameisnull
-
-
Method Detail
-
add
public TwoErrorDataSet add(double x, double y)
add point to the data set- Parameters:
x- horizontal coordinate of the new data pointy- vertical coordinate of the new data point- Returns:
- itself (fluent design)
-
add
public TwoErrorDataSet add(double x, double y, double yErrorNeg, double yErrorPos)
Add point to the data set.- Parameters:
x- the new x coordinatey- the new y coordinateyErrorNeg- the +dy erroryErrorPos- the -dy error- Returns:
- itself (fluent design)
-
add
public TwoErrorDataSet add(double x, double y, double yErrorNeg, double yErrorPos, double xErrorNeg, double xErrorPos)
Add point to the data set.- Parameters:
x- the new x coordinatey- the new y coordinateyErrorNeg- the +dy erroryErrorPos- the -dy error- Returns:
- itself (fluent design)
-
add
public TwoErrorDataSet add(double x, double y, double yErrorNeg, double yErrorPos, double xErrorNeg, double xErrorPos, java.lang.String label)
Add point to the data set.- Parameters:
x- the new x coordinatey- the new y coordinateyErrorNeg- the +dy erroryErrorPos- the -dy errorlabel- the data label- Returns:
- itself (fluent design)
-
add
public TwoErrorDataSet add(double[] xValuesNew, double[] yValuesNew, double[] yErrorsNegNew, double[] yErrorsPosNew, double[] xErrorsNegNew, double[] xErrorsPosNew)
Add array vectors to data set.- Parameters:
xValuesNew- X coordinatesyValuesNew- Y coordinatesyErrorsNegNew- the +dy errorsyErrorsPosNew- the -dy errors- Returns:
- itself (fluent design)
-
add
public TwoErrorDataSet add(int index, double... newValue)
add point to the data set- Specified by:
addin interfacede.gsi.dataset.EditableDataSet- Parameters:
index- data point index at which the new data point should be addednewValue- new data point coordinate- Returns:
- itself (fluent design)
-
add
public TwoErrorDataSet add(int index, double x, double y)
add point to the data set- Parameters:
index- data point index at which the new data point should be addedx- horizontal coordinate of the new data pointy- vertical coordinate of the new data point- Returns:
- itself (fluent design)
-
add
public TwoErrorDataSet add(int index, double x, double y, double yErrorNeg, double yErrorPos)
add point to the data set- Parameters:
index- data point index at which the new data point should be addedx- horizontal coordinate of the new data pointy- vertical coordinate of the new data point- Returns:
- itself (fluent design)
-
add
public TwoErrorDataSet add(int index, double x, double y, double yErrorNeg, double yErrorPos, double xErrorNeg, double xErrorPos)
add point to the data set- Parameters:
index- data point index at which the new data point should be addedx- horizontal coordinate of the new data pointy- vertical coordinate of the new data pointyErrorNeg- the +dy erroryErrorPos- the -dy error- Returns:
- itself (fluent design)
-
add
public TwoErrorDataSet add(int index, double x, double y, double yErrorNeg, double yErrorPos, double xErrorNeg, double xErrorPos, java.lang.String label)
add point to the data set- Parameters:
index- data point index at which the new data point should be addedx- horizontal coordinates of the new data pointy- vertical coordinates of the new data pointyErrorNeg- the +dy erroryErrorPos- the -dy errorlabel- data point label (see CategoryAxis)- Returns:
- itself (fluent design)
-
add
public TwoErrorDataSet add(int index, double[] x, double[] y, double[] yErrorNeg, double[] yErrorPos)
add point to the data set- Parameters:
index- data point index at which the new data point should be addedx- horizontal coordinate of the new data pointy- vertical coordinate of the new data pointyErrorNeg- the +dy erroryErrorPos- the -dy error- Returns:
- itself (fluent design)
-
clearData
public TwoErrorDataSet clearData()
clears all data- Returns:
- itself (fluent design)
-
get
public final double get(int dimIndex, int index)- Specified by:
getin interfacede.gsi.dataset.DataSet
-
getCapacity
public int getCapacity()
- Returns:
- storage capacity of dataset
-
getDataCount
public int getDataCount()
- Specified by:
getDataCountin interfacede.gsi.dataset.DataSet
-
getErrorNegative
public double getErrorNegative(int dimIndex, int index)- Specified by:
getErrorNegativein interfacede.gsi.dataset.DataSetError
-
getErrorPositive
public double getErrorPositive(int dimIndex, int index)- Specified by:
getErrorPositivein interfacede.gsi.dataset.DataSetError
-
getErrorsNegative
public double[] getErrorsNegative(int dimIndex)
- Specified by:
getErrorsNegativein interfacede.gsi.dataset.DataSetError
-
getErrorsPositive
public double[] getErrorsPositive(int dimIndex)
- Specified by:
getErrorsPositivein interfacede.gsi.dataset.DataSetError
-
getValues
public final double[] getValues(int dimIndex)
- Specified by:
getValuesin interfacede.gsi.dataset.DataSet- Overrides:
getValuesin classde.gsi.dataset.spi.AbstractDataSet<TwoErrorDataSet>
-
increaseCapacity
public TwoErrorDataSet increaseCapacity(int amount)
- Parameters:
amount- storage capacity increase- Returns:
- itself (fluent design)
-
remove
public TwoErrorDataSet remove(int index)
- Specified by:
removein interfacede.gsi.dataset.EditableDataSet
-
remove
public TwoErrorDataSet remove(int fromIndex, int toIndex)
remove sub-range of data points- Parameters:
fromIndex- start indextoIndex- stop index- Returns:
- itself (fluent design)
-
resize
public TwoErrorDataSet resize(int size)
ensures minimum size, enlarges if necessary- Parameters:
size- the actually used array lengths- Returns:
- itself (fluent design)
-
set
public TwoErrorDataSet set(de.gsi.dataset.DataSet other, boolean copy)
clear old data and overwrite with data from 'other' data set (deep copy)- Specified by:
setin interfacede.gsi.dataset.DataSet- Parameters:
other- the other data setcopy- true: perform a deep copy (default), false: reuse the other dataset's internal data structures (if applicable)- Returns:
- itself (fluent design)
-
set
public TwoErrorDataSet set(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- X coordinatesyValues- Y coordinatesyErrorsNeg- the +dy errorsyErrorsPos- the -dy errors- Returns:
- itself (fluent design)
-
getErrorType
public de.gsi.dataset.DataSetError.ErrorType getErrorType(int dimIndex)
- Specified by:
getErrorTypein interfacede.gsi.dataset.DataSetError- Overrides:
getErrorTypein classde.gsi.dataset.spi.AbstractErrorDataSet<TwoErrorDataSet>
-
set
public TwoErrorDataSet set(double[] xValues, double[] yValues, double[] yErrorsNeg, double[] yErrorsPos, boolean copy)
Initialises the data set with specified data.
Note: The method copies values from specified double arrays.- Parameters:
xValues- X coordinatesyValues- Y coordinatesyErrorsNeg- the +dy errorsyErrorsPos- the -dy errorscopy- true: makes an internal copy, false: use the pointer as is (saves memory allocation)- Returns:
- itself (fluent design)
-
set
public TwoErrorDataSet set(double[] xValues, double[] yValues, double[] yErrorsNeg, double[] yErrorsPos, int nSamples, boolean copy)
Initialises the data set with specified data.
Note: The method copies values from specified double arrays.- Parameters:
xValues- X coordinatesyValues- Y coordinatesyErrorsNeg- the +dy errorsyErrorsPos- the -dy errorsnSamples- number of samples to be copiedcopy- true: makes an internal copy, false: use the pointer as is (saves memory allocation)- Returns:
- itself (fluent design)
-
set
public TwoErrorDataSet set(int index, double... newValue)
replaces point coordinate of existing data point- Specified by:
setin interfacede.gsi.dataset.EditableDataSet- Parameters:
index- data point index at which the new data point should be addednewValue- new data point coordinate- Returns:
- itself (fluent design)
-
set
public TwoErrorDataSet set(int index, double x, double y)
replaces point coordinate of existing data point- Parameters:
index- the index of the data pointx- new horizontal coordinatey- new vertical coordinate N.B. errors are implicitly assumed to be zero- Returns:
- itself (fluent design)
-
set
public TwoErrorDataSet set(int index, double x, double y, double yErrorNeg, double yErrorPos)
replaces point coordinate of existing data point- Parameters:
index- the index of the data pointx- new horizontal coordinatey- new vertical coordinateyErrorNeg- new vertical negative error of y (can be asymmetric)yErrorPos- new vertical positive error of y (can be asymmetric)- Returns:
- itself (fluent design)
-
set
public TwoErrorDataSet set(int index, double[] x, double[] y, double[] yErrorNeg, double[] yErrorPos)
-
trim
public TwoErrorDataSet trim()
Trims the arrays list so that the capacity is equal to the size.- Returns:
- itself (fluent design)
- See Also:
ArrayList.trimToSize()
-
-