Package de.gsi.dataset.spi
Class AbstractHistogram
- java.lang.Object
-
- de.gsi.dataset.spi.AbstractStylable<D>
-
- de.gsi.dataset.spi.AbstractDataSet<D>
-
- de.gsi.dataset.spi.AbstractDataSet3D<AbstractHistogram>
-
- de.gsi.dataset.spi.AbstractHistogram
-
- All Implemented Interfaces:
DataSet,DataSet3D,DataSetMetaData,EventSource,Histogram
- Direct Known Subclasses:
Histogram,Histogram2
public abstract class AbstractHistogram extends AbstractDataSet3D<AbstractHistogram> implements Histogram
- Author:
- rstein
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.Integer,java.lang.String>dataLabelsprotected java.util.Map<java.lang.Integer,java.lang.String>dataStyles-
Fields inherited from class de.gsi.dataset.spi.AbstractDataSet3D
zRange
-
Fields inherited from class de.gsi.dataset.spi.AbstractDataSet
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 AbstractHistogram(java.lang.String name, double[] xBins)Creates histogram with name and range [minX, maxX]AbstractHistogram(java.lang.String name, int nBins, double minX, double maxX)Creates histogram with name and range [minX, maxX]AbstractHistogram(java.lang.String name, int nBinsX, double minX, double maxX, int nBinsY, double minY, double maxY)Creates 2D histogram with name and ranges [minX, maxX] and [minY, maxY]
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBinContent(int bin)Increment bin content by 1.voidaddBinContent(int bin, double w)Increment bin content by a weight w.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.intfindBin(double x)intfindBin(double x, double y)intfindBin(double x, double y, double z)protected intfindBinX(double x)protected intfindBinY(double y)protected intfindBinZ(double z)protected intfindNextLargerIndex(double[] bin, double value)doublegetBinCenterX(int binX)doublegetBinCenterY(int binY)doublegetBinCenterZ(int binZ)doublegetBinContent(int bin)Return content of bin number bin.java.lang.StringgetDataLabel(int index)Returns label of a data point specified by the index.java.util.Map<java.lang.Integer,java.lang.String>getDataLabelMap()java.util.Map<java.lang.Integer,java.lang.String>getDataStyleMap()intgetDimension()doublegetMaximum()doublegetMinimum()intgetNBinsX()intgetNBinsY()intgetNBinsZ()java.lang.StringgetStyle(int bin)A string representation of the CSS style associated with this specificDataSetdata point.DataRangegetValueRange()booleanisEquiDistant()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.voidreset()reset histogram contentvoidset(int xIndex, int yIndex, double x, double y, double z)Changes a data point at specified index to new values.-
Methods inherited from class de.gsi.dataset.spi.AbstractDataSet3D
computeLimits, getDataCount, getXIndex, getYIndex, getZRange
-
Methods inherited from class de.gsi.dataset.spi.AbstractDataSet
binarySearchX, binarySearchY, fireInvalidated, getDataCount, getDefaultDataLabel, getEditConstraints, getErrorList, getInfoList, getMetaInfo, getName, getThis, getUndefValue, getWarningList, getXMax, getXMin, getXRange, getYMax, getYMin, getYRange, isAutoNotification, lock, minNeigbourSearchX, 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
getDataCount, getDataCount, getName, getStyle, getUndefValue, getValue, getX, getXIndex, getXMax, getXMin, getXValues, getY, getYIndex, getYMax, getYMin, getYValues, isAutoNotification, lock, setAutoNotifaction, setStyle, unlock
-
Methods inherited from interface de.gsi.dataset.DataSet3D
getXDataCount, getYDataCount, getZ, getZRange
-
Methods inherited from interface de.gsi.dataset.DataSetMetaData
getErrorList, getInfoList, getMetaInfo, getWarningList
-
Methods inherited from interface de.gsi.dataset.event.EventSource
addListener, invokeListener, invokeListener, removeListener, updateEventListener
-
-
-
-
Constructor Detail
-
AbstractHistogram
public AbstractHistogram(java.lang.String name, int nBins, double minX, double maxX)Creates histogram with name and range [minX, maxX]- Parameters:
name- of the data setsnBins- number of binsminX- minimum of rangemaxX- maximum of range
-
AbstractHistogram
public AbstractHistogram(java.lang.String name, int nBinsX, double minX, double maxX, int nBinsY, double minY, double maxY)Creates 2D histogram with name and ranges [minX, maxX] and [minY, maxY]- Parameters:
name- of the data setsnBinsX- number of horizontal binsminX- minimum of horizontal rangemaxX- maximum of horizontal rangenBinsY- number of vertical binsminY- minimum of vertical rangemaxY- maximum of vertical range
-
AbstractHistogram
public AbstractHistogram(java.lang.String name, double[] xBins)Creates histogram with name and range [minX, maxX]- Parameters:
name- of the data setsxBins- the initial bin array (defines [minX, maxX] and nBins)
-
-
Method Detail
-
isEquiDistant
public boolean isEquiDistant()
- Specified by:
isEquiDistantin interfaceHistogram- Returns:
- true if bin sizes are equal
-
getValueRange
public DataRange getValueRange()
- Returns:
- range of bin contents
-
getDataLabelMap
public java.util.Map<java.lang.Integer,java.lang.String> getDataLabelMap()
- Returns:
- data labels for each bin
-
getDataStyleMap
public java.util.Map<java.lang.Integer,java.lang.String> getDataStyleMap()
- Returns:
- data styling map (CSS-related)
-
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()- Overrides:
addDataStylein classAbstractDataSet<AbstractHistogram>- Parameters:
index- the index of the specific data pointstyle- the CSS style for the given data bin- Returns:
- itself (fluent interface)
-
removeStyle
public java.lang.String removeStyle(int index)
A string representation of the CSS style associated with this specificDataSetdata point. @see #getStyle()- Overrides:
removeStylein classAbstractDataSet<AbstractHistogram>- Parameters:
index- the index of the specific data point- Returns:
- itself (fluent interface)
-
getStyle
public java.lang.String getStyle(int bin)
A string representation of the CSS style associated with this specificDataSetdata point. @see #getStyle()- Specified by:
getStylein interfaceDataSet- Overrides:
getStylein classAbstractDataSet<AbstractHistogram>- Parameters:
bin- the index of the specific data point- Returns:
- user-specific data set style description (ie. may be set by user)
-
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.- Overrides:
addDataLabelin classAbstractDataSet<AbstractHistogram>- 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
-
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.- Overrides:
removeDataLabelin classAbstractDataSet<AbstractHistogram>- Parameters:
index- of the data point- Returns:
- the previously set label or
nullif no label has been specified
-
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- Overrides:
getDataLabelin classAbstractDataSet<AbstractHistogram>- Parameters:
index- of the data label- Returns:
- data point label specified by the index or
nullif no label has been specified
-
getBinContent
public double getBinContent(int bin)
Description copied from interface:HistogramReturn content of bin number bin. Convention for numbering bins For all histogram types: nbins, xlow, xup bin = 0; underflow bin bin = 1; first bin with low-edge xlow INCLUDED bin = nbins; last bin with upper-edge xup EXCLUDED bin = nbins+1; overflow bin- Specified by:
getBinContentin interfaceHistogram- Parameters:
bin- the index- Returns:
- numeric bin content
-
addBinContent
public void addBinContent(int bin)
Description copied from interface:HistogramIncrement bin content by 1. More...- Specified by:
addBinContentin interfaceHistogram- Parameters:
bin- global bin ID
-
addBinContent
public void addBinContent(int bin, double w)Description copied from interface:HistogramIncrement bin content by a weight w. More...- Specified by:
addBinContentin interfaceHistogram- Parameters:
bin- global bin IDw- weight
-
getMinimum
public double getMinimum()
- Specified by:
getMinimumin interfaceHistogram- Returns:
- minimum of histogram values
-
getMaximum
public double getMaximum()
- Specified by:
getMaximumin interfaceHistogram- Returns:
- maximum of histogram values
-
findNextLargerIndex
protected int findNextLargerIndex(double[] bin, double value)
-
findBin
public int findBin(double x)
-
findBinX
protected int findBinX(double x)
-
findBinY
protected int findBinY(double y)
-
findBinZ
protected int findBinZ(double z)
-
findBin
public int findBin(double x, double y)
-
findBin
public int findBin(double x, double y, double z)
-
getBinCenterX
public double getBinCenterX(int binX)
- Specified by:
getBinCenterXin interfaceHistogram- Parameters:
binX- index- Returns:
- bin centre for X axis
-
getBinCenterY
public double getBinCenterY(int binY)
- Specified by:
getBinCenterYin interfaceHistogram- Parameters:
binY- index- Returns:
- bin centre for X axis
-
getBinCenterZ
public double getBinCenterZ(int binZ)
- Specified by:
getBinCenterZin interfaceHistogram- Parameters:
binZ- index- Returns:
- bin centre for X axis
-
reset
public void reset()
Description copied from interface:Histogramreset histogram content
-
getDimension
public int getDimension()
- Specified by:
getDimensionin interfaceHistogram- Returns:
- number of dimensions
-
getNBinsX
public int getNBinsX()
-
getNBinsY
public int getNBinsY()
-
getNBinsZ
public int getNBinsZ()
-
set
public void set(int xIndex, int yIndex, double x, double y, double z)Description copied from interface:DataSet3DChanges a data point at specified index to new values.
-
-