Package cnuphys.splot.pdata
Class DataColumn
java.lang.Object
cnuphys.splot.pdata.GrowableArray
cnuphys.splot.pdata.DataColumn
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Fit
protected String
protected DataColumnType
protected boolean
Fields inherited from class cnuphys.splot.pdata.GrowableArray
_data, _dataLen, _increment, _initCap, _maxValue, _minValue
-
Constructor Summary
ConstructorsConstructorDescriptionDataColumn
(DataColumnType type, String name) Creates a DataColumn with initial capacity 100 and increment 100.DataColumn
(DataColumnType type, String name, int initCap, int increment) Create a DataColumn -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(double val) Add a value to the array, growing it if necessary.void
clear()
Reset the data array to the initial capacity and fill with all NaNs.getFit()
Get the FitThis gets the histogram data, which for non-histograms will benull
.This gets the histogram 2D data, which for non-histograms will benull
.double
getMean()
Get the meangetName()
Get the name of the arraydouble
Get the standard deviationgetStyle()
Get the style for this columngetType()
Get the type of this data columndouble
Get the variance.void
histo2DAdd
(double xval, double yval) Add used only by 2D histogramsprotected void
initFit()
Initialize a fit objectprotected void
Init the style sort of randomlyboolean
Checks whether this is a 1D histogramboolean
Checks whether this is a 2D histogramboolean
Check whether this "curve" is visible.void
set
(int index, double val) Set the value at the given indexprotected void
setHistoData
(HistoData histo) Set the histogram data containerprotected void
setHistoData2D
(Histo2DData histo2D) Set the histogram 2D data containervoid
Set the nameprotected void
Set the stylevoid
setVisible
(boolean visible) Set whether this "curve" is visible.toString()
Get a string representationMethods inherited from class cnuphys.splot.pdata.GrowableArray
get, getMaxValue, getMinimalCopy, getMinValue, removeFirst, size
-
Field Details
-
_fit
-
_name
-
_type
-
_visible
protected boolean _visible
-
-
Constructor Details
-
DataColumn
Creates a DataColumn with initial capacity 100 and increment 100.- Parameters:
name
- the column name
-
DataColumn
Create a DataColumn- Parameters:
name
- the column nameinitCap
- the initial capacityincrement
- the increment when the array grows.
-
-
Method Details
-
getHistoData
This gets the histogram data, which for non-histograms will benull
.- Returns:
- the histogram data
-
setHistoData
Set the histogram data container- Parameters:
histo
- the histogram data
-
getHistoData2D
This gets the histogram 2D data, which for non-histograms will benull
.- Returns:
- the histogram 2D data
-
setHistoData2D
Set the histogram 2D data container- Parameters:
histo2D
- the histogram 2D data
-
isHistogram1D
public boolean isHistogram1D()Checks whether this is a 1D histogram- Returns:
true
if this is a 1D histogram
-
isHistogram2D
public boolean isHistogram2D()Checks whether this is a 2D histogram- Returns:
true
if this is a 2D histogram
-
isVisible
public boolean isVisible()Check whether this "curve" is visible. Only relevant for Y columns.- Returns:
- the visibility flag
-
setName
Set the name- Parameters:
name
- the name of the data column
-
getName
Get the name of the array- Returns:
- the name of the array
-
setVisible
public void setVisible(boolean visible) Set whether this "curve" is visible. Only relevant for Y columns.- Parameters:
visible
- the visibility flag.
-
getType
Get the type of this data column- Returns:
- the type of this data column
-
initStyle
protected void initStyle()Init the style sort of randomly -
initFit
protected void initFit()Initialize a fit object -
setStyle
Set the style- Parameters:
style
- the new style
-
getStyle
Get the style for this column- Returns:
- the style for this column
-
toString
Get a string representation -
getFit
Get the Fit- Returns:
- the fit
-
histo2DAdd
public void histo2DAdd(double xval, double yval) Add used only by 2D histograms- Parameters:
xval
- the x valueyval
- the y value
-
add
public void add(double val) Add a value to the array, growing it if necessary.- Overrides:
add
in classGrowableArray
- Parameters:
val
- the value to add
-
getMean
public double getMean()Get the mean- Returns:
- the mean
-
getVariance
public double getVariance()Get the variance. Note: divides by N, not N-1- Returns:
- the variance.
-
getStandardDeviation
public double getStandardDeviation()Get the standard deviation- Returns:
- the standard deviation
-
clear
public void clear()Reset the data array to the initial capacity and fill with all NaNs.- Overrides:
clear
in classGrowableArray
-
set
public void set(int index, double val) Set the value at the given index- Overrides:
set
in classGrowableArray
- Parameters:
index
- the indexval
- the value at the index
-