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.DoubleArrayList
xErrorsNeg
protected it.unimi.dsi.fastutil.doubles.DoubleArrayList
xErrorsPos
protected it.unimi.dsi.fastutil.doubles.DoubleArrayList
xValues
protected it.unimi.dsi.fastutil.doubles.DoubleArrayList
yErrorsNeg
protected it.unimi.dsi.fastutil.doubles.DoubleArrayList
yErrorsPos
protected it.unimi.dsi.fastutil.doubles.DoubleArrayList
yValues
-
Constructor Summary
Constructors Constructor Description TwoErrorDataSet(de.gsi.dataset.DataSet another)
Creates a new instance ofDoubleErrorDataSet
as 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 TwoErrorDataSet
add(double[] xValuesNew, double[] yValuesNew, double[] yErrorsNegNew, double[] yErrorsPosNew, double[] xErrorsNegNew, double[] xErrorsPosNew)
Add array vectors to data set.TwoErrorDataSet
add(double x, double y)
add point to the data setTwoErrorDataSet
add(double x, double y, double yErrorNeg, double yErrorPos)
Add point to the data set.TwoErrorDataSet
add(double x, double y, double yErrorNeg, double yErrorPos, double xErrorNeg, double xErrorPos)
Add point to the data set.TwoErrorDataSet
add(double x, double y, double yErrorNeg, double yErrorPos, double xErrorNeg, double xErrorPos, java.lang.String label)
Add point to the data set.TwoErrorDataSet
add(int index, double... newValue)
add point to the data setTwoErrorDataSet
add(int index, double[] x, double[] y, double[] yErrorNeg, double[] yErrorPos)
add point to the data setTwoErrorDataSet
add(int index, double x, double y)
add point to the data setTwoErrorDataSet
add(int index, double x, double y, double yErrorNeg, double yErrorPos)
add point to the data setTwoErrorDataSet
add(int index, double x, double y, double yErrorNeg, double yErrorPos, double xErrorNeg, double xErrorPos)
add point to the data setTwoErrorDataSet
add(int index, double x, double y, double yErrorNeg, double yErrorPos, double xErrorNeg, double xErrorPos, java.lang.String label)
add point to the data setTwoErrorDataSet
clearData()
clears all datadouble
get(int dimIndex, int index)
int
getCapacity()
int
getDataCount()
double
getErrorNegative(int dimIndex, int index)
double
getErrorPositive(int dimIndex, int index)
double[]
getErrorsNegative(int dimIndex)
double[]
getErrorsPositive(int dimIndex)
de.gsi.dataset.DataSetError.ErrorType
getErrorType(int dimIndex)
double[]
getValues(int dimIndex)
TwoErrorDataSet
increaseCapacity(int amount)
TwoErrorDataSet
remove(int index)
TwoErrorDataSet
remove(int fromIndex, int toIndex)
remove sub-range of data pointsTwoErrorDataSet
resize(int size)
ensures minimum size, enlarges if necessaryTwoErrorDataSet
set(double[] xValues, double[] yValues, double[] yErrorsNeg, double[] yErrorsPos)
Initialises the data set with specified data.TwoErrorDataSet
set(double[] xValues, double[] yValues, double[] yErrorsNeg, double[] yErrorsPos, boolean copy)
Initialises the data set with specified data.TwoErrorDataSet
set(double[] xValues, double[] yValues, double[] yErrorsNeg, double[] yErrorsPos, int nSamples, boolean copy)
Initialises the data set with specified data.TwoErrorDataSet
set(int index, double... newValue)
replaces point coordinate of existing data pointTwoErrorDataSet
set(int index, double[] x, double[] y, double[] yErrorNeg, double[] yErrorPos)
TwoErrorDataSet
set(int index, double x, double y)
replaces point coordinate of existing data pointTwoErrorDataSet
set(int index, double x, double y, double yErrorNeg, double yErrorPos)
replaces point coordinate of existing data pointTwoErrorDataSet
set(de.gsi.dataset.DataSet other, boolean copy)
clear old data and overwrite with data from 'other' data set (deep copy)TwoErrorDataSet
trim()
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 ofDoubleErrorDataSet
as 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
- ifname
isnull
-
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
- ifname
isnull
-
-
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:
add
in 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:
get
in interfacede.gsi.dataset.DataSet
-
getCapacity
public int getCapacity()
- Returns:
- storage capacity of dataset
-
getDataCount
public int getDataCount()
- Specified by:
getDataCount
in interfacede.gsi.dataset.DataSet
-
getErrorNegative
public double getErrorNegative(int dimIndex, int index)
- Specified by:
getErrorNegative
in interfacede.gsi.dataset.DataSetError
-
getErrorPositive
public double getErrorPositive(int dimIndex, int index)
- Specified by:
getErrorPositive
in interfacede.gsi.dataset.DataSetError
-
getErrorsNegative
public double[] getErrorsNegative(int dimIndex)
- Specified by:
getErrorsNegative
in interfacede.gsi.dataset.DataSetError
-
getErrorsPositive
public double[] getErrorsPositive(int dimIndex)
- Specified by:
getErrorsPositive
in interfacede.gsi.dataset.DataSetError
-
getValues
public final double[] getValues(int dimIndex)
- Specified by:
getValues
in interfacede.gsi.dataset.DataSet
- Overrides:
getValues
in 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:
remove
in 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:
set
in 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:
getErrorType
in interfacede.gsi.dataset.DataSetError
- Overrides:
getErrorType
in 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:
set
in 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()
-
-