Package de.gsi.dataset.spi
Class AveragingDataSet
- java.lang.Object
-
- de.gsi.dataset.spi.AbstractStylable<D>
-
- de.gsi.dataset.spi.AbstractDataSet<AveragingDataSet>
-
- de.gsi.dataset.spi.AveragingDataSet
-
- All Implemented Interfaces:
DataSet,DataSetMetaData,EventSource
public class AveragingDataSet extends AbstractDataSet<AveragingDataSet>
TODO: Change to ErrorDataSet and calculate standard deviation.- Author:
- braeun
-
-
Field Summary
-
Fields inherited from class de.gsi.dataset.spi.AbstractDataSet
dataLabels, dataStyles, editConstraints, lock, metaInfoMap, name, updateListeners, xRange, yRange
-
Fields inherited from interface de.gsi.dataset.DataSetMetaData
TAG_GAIN_RANGE, TAG_OVERSHOOT, TAG_UNDERSHOOT
-
-
Constructor Summary
Constructors Constructor Description AveragingDataSet(java.lang.String name)AveragingDataSet(java.lang.String name, int fuzzyCount)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(DataSet ds)voidclear()clear all dataintgetAverageCount()intgetAverageSize()intgetDataCount()Get the number of data points in the data setintgetDataCount(double xmin, double xmax)Gets the number of data points in the range xmin to xmax.intgetFuzzyCount()Gets the fuzzy count.java.lang.StringgetStyle(int index)A string representation of the CSS style associated with this specificDataSetdata point.doublegetX(int i)Gets the x value of the data point with the index iintgetXIndex(double x)Gets the index of the data point closest to the given x coordinate.doublegetXMax()Gets the maximum x value of the data set.doublegetXMin()Gets the minimum x value of the data set.doublegetY(int i)Gets the y value of the data point with the index idoublegetYMax()Gets the maximum y value of the data set.doublegetYMin()Gets the minimum y value of the data set.double[]getYValues()voidsetAverageSize(int avgCount)voidsetFuzzyCount(int fuzzyCount)Sets the fuzzy count.-
Methods inherited from class de.gsi.dataset.spi.AbstractDataSet
addDataLabel, addDataStyle, binarySearchX, binarySearchY, computeLimits, fireInvalidated, getDataLabel, getDefaultDataLabel, getEditConstraints, getErrorList, getInfoList, getMetaInfo, getName, getThis, getUndefValue, getWarningList, getXRange, getYIndex, getYRange, isAutoNotification, lock, minNeigbourSearchX, removeDataLabel, removeStyle, setAutoNotifaction, setEditConstraints, setName, toString, unlock, updateEventListener
-
Methods inherited from class de.gsi.dataset.spi.AbstractStylable
getStyle, setStyle
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.gsi.dataset.DataSet
getStyle, getValue, getXValues, setStyle
-
Methods inherited from interface de.gsi.dataset.event.EventSource
addListener, invokeListener, invokeListener, removeListener
-
-
-
-
Method Detail
-
getFuzzyCount
public int getFuzzyCount()
Gets the fuzzy count.- Returns:
- fuzzy count
-
setFuzzyCount
public void setFuzzyCount(int fuzzyCount)
Sets the fuzzy count. The fuzzy count allows for a mismatch in the data count of the datasets added to the average. Datasets will be added if the size difference is less or equal to the fuzzy count. In case of a mismatch in size, the longer dataset will be truncated to the shorter one.- Parameters:
fuzzyCount- the fuzzy count
-
getAverageSize
public int getAverageSize()
- Returns:
- number of data sets that are supposed to be averaged
-
setAverageSize
public void setAverageSize(int avgCount)
- Parameters:
avgCount- number of data sets that are supposed to be averaged
-
getAverageCount
public int getAverageCount()
- Returns:
- number of data sets that have been averaged
-
clear
public void clear()
clear all data
-
add
public void add(DataSet ds)
- Parameters:
ds- new DataSet to be added to average
-
getDataCount
public int getDataCount()
Description copied from interface:DataSetGet the number of data points in the data set- Returns:
- the number of data points
-
getDataCount
public int getDataCount(double xmin, double xmax)Description copied from class:AbstractDataSetGets the number of data points in the range xmin to xmax.- Specified by:
getDataCountin interfaceDataSet- Overrides:
getDataCountin classAbstractDataSet<AveragingDataSet>- Parameters:
xmin- the lower end of the rangexmax- the upper end of the range- Returns:
- the number of data points
-
getYValues
public double[] getYValues()
- Returns:
- the y value array
-
getX
public double getX(int i)
Description copied from interface:DataSetGets the x value of the data point with the index i- Parameters:
i- the index of the data point- Returns:
- the x value
-
getY
public double getY(int i)
Description copied from interface:DataSetGets the y value of the data point with the index i- Parameters:
i- the index of the data point- Returns:
- the y value
-
getXIndex
public int getXIndex(double x)
Description copied from class:AbstractDataSetGets the index of the data point closest to the given x 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.- Specified by:
getXIndexin interfaceDataSet- Overrides:
getXIndexin classAbstractDataSet<AveragingDataSet>- Parameters:
x- the x position of the data point- Returns:
- the index of the data point
-
getXMin
public double getXMin()
Description copied from class:AbstractDataSetGets the minimum x value of the data set.- Specified by:
getXMinin interfaceDataSet- Overrides:
getXMinin classAbstractDataSet<AveragingDataSet>- Returns:
- minimum x value
-
getXMax
public double getXMax()
Description copied from class:AbstractDataSetGets the maximum x value of the data set.- Specified by:
getXMaxin interfaceDataSet- Overrides:
getXMaxin classAbstractDataSet<AveragingDataSet>- Returns:
- maximum x value
-
getYMin
public double getYMin()
Description copied from class:AbstractDataSetGets the minimum y value of the data set.- Specified by:
getYMinin interfaceDataSet- Overrides:
getYMinin classAbstractDataSet<AveragingDataSet>- Returns:
- minimum y value
-
getYMax
public double getYMax()
Description copied from class:AbstractDataSetGets the maximum y value of the data set.- Specified by:
getYMaxin interfaceDataSet- Overrides:
getYMaxin classAbstractDataSet<AveragingDataSet>- Returns:
- maximum y value
-
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<AveragingDataSet>- Parameters:
index- the index of the specific data point- Returns:
- user-specific data set style description (ie. may be set by user)
-
-