Class DataSet

All Implemented Interfaces:
Serializable, TableModel

public class DataSet extends DefaultTableModel
This is essentially a table of not necessarily equal length columns.
Author:
heddle
See Also:
  • Constructor Details Link icon

    • DataSet Link icon

      public DataSet(Histo2DData h2d) throws DataSetException
      This constructor is for a 2D histogram
      Parameters:
      h2d -
      Throws:
      DataSetException
    • DataSet Link icon

      public DataSet(HistoData... histos) throws DataSetException
      This constructor is used for 1D histograms
      Parameters:
      histos - an array of histo data objects
      Throws:
      DataSetException
    • DataSet Link icon

      public DataSet(StripData stripData, String... colNames)
      Create a dataset for a simple strip chart
      Parameters:
      stripData - the StripData data object
      colNames - should be just two of them
    • DataSet Link icon

      public DataSet(DataSetType type, String... colNames) throws DataSetException
      Create a dataset of a specific type
      Parameters:
      type - the dataset type
      colNames - the column names. There should be one name for every expected column based on the type.
      Throws:
      DataSetException - When the number of columns is inconsistent with the type
  • Method Details Link icon

    • size Link icon

      public long size()
      Get the number of data points in the first column of a plot.
      Returns:
      the number of data points
    • addCurve Link icon

      public DataColumn addCurve(String xname, String yname)
      Add a curve to an existing data set. For now limited to type XYXY only.
      Parameters:
      xname - the name for the new xdata (ignored for some types)
      yname - the name for the new y data
    • addToCurve Link icon

      public void addToCurve(int curveIndex, double... vals) throws DataSetException
      Add data to a specific curve. For now limited to type XYXY only.
      Throws:
      DataSetException
    • hasXErrors Link icon

      public boolean hasXErrors()
      Check to see if this data set has x errors
      Returns:
      true if this set has x errors
    • is1DHistoSet Link icon

      public boolean is1DHistoSet()
      Check to see if this data set is for 1D Histograms
      Returns:
      true if this is for 1D histograms
    • is2DHistoSet Link icon

      public boolean is2DHistoSet()
      Check to see if this data set is for 2D Histograms
      Returns:
      true if this is for 2D histograms
    • setAllFitsDirty Link icon

      public void setAllFitsDirty()
      Set all fits to dirty.
    • getCurve Link icon

      public DataColumn getCurve(int index)
      Get a curve from an index. E.g., f the index is 0 it will return the 1st Y column. Y Columns are also known as "curves".
      Parameters:
      index - the index
      Returns:
      the corresponding curve
    • getXColumn Link icon

      public DataColumn getXColumn(int index)
      Get a x column from an index. E.g., f the index is 0 it will return the 1st X column.
      Parameters:
      index - the index
      Returns:
      the corresponding X column
    • getCurveStyle Link icon

      public IStyled getCurveStyle(int index)
      Get the style for the curve at the given index.
      Parameters:
      index - the curve index.
      Returns:
      the style
    • standardDev Link icon

      public static double standardDev(double[] x)
      Compute the "standard" standard deviation (divide variance by N) using an accurate one-pass method.
      Parameters:
      x - the data
      Returns:
      the standard deviation
    • getType Link icon

      public DataSetType getType()
      Get the DataSet type
      Returns:
      the data set type
    • getColumnMin Link icon

      public double getColumnMin(int index)
      Get the minimum value of a column
      Parameters:
      index - the index of the column
      Returns:
      the minimum value of the x data
    • getColumnMax Link icon

      public double getColumnMax(int index)
      Get the maximum value of a column
      Parameters:
      index - the index of the column
      Returns:
      the maximum value of the x data
    • getAllVisibleCurves Link icon

      public Collection<DataColumn> getAllVisibleCurves()
      Get a collection of all the curves that are set visible.
      Returns:
      a collection of all the curves that are set visible.
    • getAllCurves Link icon

      public Collection<DataColumn> getAllCurves()
      Get all curves, visible or not
      Returns:
      a collection of all the curves, visible or not
    • getCurveCount Link icon

      public int getCurveCount()
      Get a count of all the curves
      Returns:
      a count of all the curves
    • dataAdded Link icon

      public boolean dataAdded()
      Has any data been added
      Returns:
      trueinvalid input: '<'.code> if any data has been added.
    • getAllColumnsByType Link icon

      public Collection<DataColumn> getAllColumnsByType(DataColumnType type)
      Get all the columns of a given type. For example, all the Y columns
      Parameters:
      type - the type to match
      Returns:
      all the matching columns
    • getAllHistos Link icon

      public Vector<HistoData> getAllHistos()
      Get all the histo data
      Returns:
      a collection of the histo data
    • getXmin Link icon

      public double getXmin()
      Convenience method to get the minimum value of the x data
      Returns:
      the minimum value of the x data
    • getXmax Link icon

      public double getXmax()
      Convenience method to get the maximum value of the x data
      Returns:
      the minimum value of the x data
    • getYmin Link icon

      public double getYmin()
      Convenience function to get the minimum value of the y data. If there is more than one y column, it returns the overall minimum.
      Returns:
      the minimum value of the y data
    • getYmax Link icon

      public double getYmax()
      Convenience function to get the maximum value of the y data. If there is more than one y column, it returns the overall maximum.
      Returns:
      the maximum value of the y data
    • getDataMin Link icon

      public double getDataMin(DataColumnType type)
      Get the overall min for all columns of the given type
      Parameters:
      type - the type to match
      Returns:
      the overall min for the given type
    • getDataMax Link icon

      public double getDataMax(DataColumnType type)
      Get the overall max for all columns of the given type
      Parameters:
      type - the type to match
      Returns:
      the overall max for the given type
    • getMinimalArray Link icon

      public double[] getMinimalArray(int index)
      Get the minimal array of a column. The minimal array is a copy from the underlying GrowableArray that is the same size as the amount of real data.
      Parameters:
      index - the column index
      Returns:
      the minimal array
    • getSize Link icon

      public int getSize()
      Get the size of the real data, This is the same as the row count.
      Returns:
      the data count
    • getFit Link icon

      public Fit getFit(int index)
      Get the fit for a given column
      Parameters:
      index - the column index
      Returns:
      the fit for the column
    • add Link icon

      public void add(double... vals) throws DataSetException
      Add data values. This is the only entry point.
      Parameters:
      vals - a variable number of entries for the columns
      Throws:
      DataSetException
    • add Link icon

      public void add(int column, double val) throws DataSetException
      Add data value to a specific column.
      Parameters:
      column - the column
      val - the value
      Throws:
      DataSetException
    • clear Link icon

      public void clear()
      Clear all the data.
    • notifyListeners Link icon

      public void notifyListeners()
    • addDataChangeListener Link icon

      public void addDataChangeListener(DataChangeListener DataChangeListener)
      Add a data change listener
      Parameters:
      DataChangeListener - the listener to add
    • removeDataChangeListener Link icon

      public void removeDataChangeListener(DataChangeListener DataChangeListener)
      Remove a DataChangeListener.
      Parameters:
      DataChangeListener - the DataChangeListener to remove.
    • getColumnStyle Link icon

      public Styled getColumnStyle(int index)
      Get the style for a column
      Parameters:
      index - the column index
      Returns:
      the style for this dataset
    • getColumns Link icon

      public Collection<DataColumn> getColumns()
      Get all the data columns
      Returns:
      all the data columns
    • getColumn Link icon

      public DataColumn getColumn(int index)
      Get the column at a specific index
      Parameters:
      index - the column index
      Returns:
      the column at a specific index
    • getRowCount Link icon

      public int getRowCount()
      Specified by:
      getRowCount in interface TableModel
      Overrides:
      getRowCount in class DefaultTableModel
    • getColumnCount Link icon

      public int getColumnCount()
      Specified by:
      getColumnCount in interface TableModel
      Overrides:
      getColumnCount in class DefaultTableModel
    • getColumnClass Link icon

      public Class<?> getColumnClass(int columnIndex)
      Specified by:
      getColumnClass in interface TableModel
      Overrides:
      getColumnClass in class AbstractTableModel
    • isCellEditable Link icon

      public boolean isCellEditable(int rowIndex, int columnIndex)
      Specified by:
      isCellEditable in interface TableModel
      Overrides:
      isCellEditable in class DefaultTableModel
    • getValueAt Link icon

      public Object getValueAt(int rowIndex, int columnIndex)
      Specified by:
      getValueAt in interface TableModel
      Overrides:
      getValueAt in class DefaultTableModel
    • setValueAt Link icon

      public void setValueAt(Object aValue, int rowIndex, int columnIndex)
      Specified by:
      setValueAt in interface TableModel
      Overrides:
      setValueAt in class DefaultTableModel