Class DataColumn

java.lang.Object
cnuphys.splot.pdata.GrowableArray
cnuphys.splot.pdata.DataColumn

public class DataColumn extends GrowableArray
  • Field Details

    • _fit

      protected Fit _fit
    • _name

      protected String _name
    • _type

      protected DataColumnType _type
    • _visible

      protected boolean _visible
  • Constructor Details

    • DataColumn

      public DataColumn(DataColumnType type, String name)
      Creates a DataColumn with initial capacity 100 and increment 100.
      Parameters:
      name - the column name
    • DataColumn

      public DataColumn(DataColumnType type, String name, int initCap, int increment)
      Create a DataColumn
      Parameters:
      name - the column name
      initCap - the initial capacity
      increment - the increment when the array grows.
  • Method Details

    • getHistoData

      public HistoData getHistoData()
      This gets the histogram data, which for non-histograms will be null.
      Returns:
      the histogram data
    • setHistoData

      protected void setHistoData(HistoData histo)
      Set the histogram data container
      Parameters:
      histo - the histogram data
    • getHistoData2D

      public Histo2DData getHistoData2D()
      This gets the histogram 2D data, which for non-histograms will be null.
      Returns:
      the histogram 2D data
    • setHistoData2D

      protected void setHistoData2D(Histo2DData histo2D)
      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

      public void setName(String name)
      Set the name
      Parameters:
      name - the name of the data column
    • getName

      public String 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

      public DataColumnType 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

      protected void setStyle(Styled style)
      Set the style
      Parameters:
      style - the new style
    • getStyle

      public Styled getStyle()
      Get the style for this column
      Returns:
      the style for this column
    • toString

      public String toString()
      Get a string representation
      Overrides:
      toString in class Object
      Returns:
      a string representation
    • getFit

      public Fit 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 value
      yval - the y value
    • add

      public void add(double val)
      Add a value to the array, growing it if necessary.
      Overrides:
      add in class GrowableArray
      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 class GrowableArray
    • set

      public void set(int index, double val)
      Set the value at the given index
      Overrides:
      set in class GrowableArray
      Parameters:
      index - the index
      val - the value at the index