Module platform

Class Dataset

java.lang.Object
de.grogra.pf.data.Dataset
All Implemented Interfaces:
Shareable, Showable, Serializable

public final class Dataset extends Object implements Shareable, Serializable, Showable
A Dataset contains a set of Datacells which are arranged in a tabular scheme, i.e., in rows and columns.
Author:
Ole Kniemeyer
See Also:
  • Field Details

    • MIME_TYPE

      public static final MimeType MIME_TYPE
  • Constructor Details

    • Dataset

      public Dataset()
  • Method Details

    • asDatasetAdapter

      public DatasetAdapter asDatasetAdapter()
      Returns a view of this dataset as an instance of DatasetAdapter. Note that the meanings of rows and columns are exchanged.
      Returns:
      dataset as a DatasetAdapter
    • toHistogram

      public HistogramAdapter toHistogram()
      Returns a histogram of this dataset.
      Returns:
      dataset as a DatasetAdapter
    • toStatistics

      public StatisticsAdapter toStatistics()
      Returns a statistics view of this dataset.
      Returns:
      dataset as a StatisticsAdapter
    • asTableModel

      public TableModel asTableModel()
      Returns a view of this dataset as an instance of TableModel.
      Returns:
      dataset as a TableModel
    • initProvider

      public void initProvider(SharedObjectProvider provider)
      Specified by:
      initProvider in interface Shareable
    • getProvider

      public SharedObjectProvider getProvider()
      Specified by:
      getProvider in interface Shareable
    • addReference

      public void addReference(SharedObjectReference ref)
      Specified by:
      addReference in interface Shareable
    • removeReference

      public void removeReference(SharedObjectReference ref)
      Specified by:
      removeReference in interface Shareable
    • appendReferencesTo

      public void appendReferencesTo(List out)
      Specified by:
      appendReferencesTo in interface Shareable
    • getGroup

      public DatasetGroup getGroup()
    • setGroup

      public void setGroup(DatasetGroup group)
    • setSeriesInRows

      public Dataset setSeriesInRows(boolean value)
    • hasSeriesInRows

      public boolean hasSeriesInRows()
    • clear

      public Dataset clear()
      Clears this dataset. This removes all rows, columns, and their keys.
      Returns:
      this dataset
    • getCell

      public Datacell getCell(int row, int col)
      Returns the datacell at row and column. The rows and columns are extended if necessary.
      Parameters:
      row - row index of cell
      col - column index of cell
      Returns:
      datacell at specified location
    • hasCell

      public boolean hasCell(int row, int col)
    • getDomainOrder

      public DomainOrder getDomainOrder()
    • setDomainOrder

      public void setDomainOrder(DomainOrder order)
    • getTitle

      public String getTitle()
    • setTitle

      public Dataset setTitle(String s)
    • getCategoryLabel

      public String getCategoryLabel()
    • setCategoryLabel

      public Dataset setCategoryLabel(String s)
    • getValueLabel

      public String getValueLabel()
    • setValueLabel

      public Dataset setValueLabel(String s)
    • getRowCount

      public int getRowCount()
      Returns the number of rows of this dataset.
      Returns:
      number of rows
    • getRowCount

      public int getRowCount(int column)
    • getColumnCount

      public int getColumnCount()
      Returns the number of columns of this dataset.
      Returns:
      number of columns
      See Also:
    • getColumnCount

      public int getColumnCount(int row)
      Returns the number of columns which are defined in row. The returned value does not exceed getColumnCount().
      Parameters:
      row - row index
      Returns:
      number of columns in row
    • getRow

      public Dataseries getRow(int row)
      Returns row as a dataseries.
      Parameters:
      row - row index
      Returns:
      specified row represented as a dataseries
    • getColumn

      public Dataseries getColumn(int column)
      Returns column as a dataseries.
      Parameters:
      column - column index
      Returns:
      specified column represented as a dataseries
    • addRow

      public Dataseries addRow()
      Adds a new row to this dataset and returns it as a dataseries.
      Returns:
      added row as a dataseries
    • addColumn

      public Dataseries addColumn()
      Adds a new column to this dataset and returns it as a dataseries.
      Returns:
      added column as a dataseries
    • addRow

      public Dataseries addRow(Comparable key)
      Adds a new row to this dataset and returns it as a dataseries.
      Parameters:
      key - row key to use
      Returns:
      added row as a dataseries
    • addColumn

      public Dataseries addColumn(Comparable key)
      Adds a new column to this dataset and returns it as a dataseries.
      Parameters:
      key - column key to use
      Returns:
      added column as a dataseries
    • operator$shl

      public Dataseries operator$shl(Number v)
    • operator$shl

      public Dataseries operator$shl(double[] v)
    • getRowKey

      public Comparable getRowKey(int row)
      Returns the key for the row with index row. If such a key has not been set explicitly by setRowKey(int, Comparable), an instance of Integer is returned, its value being row + 1.
      Parameters:
      row - row index
      Returns:
      key for row
    • getColumnKey

      public Comparable getColumnKey(int column)
      Returns the key for the column with index column. If such a key has not been set explicitly by setColumnKey(int, Comparable), an instance of Character is returned, its value being column + 'A'.
      Parameters:
      column - column index
      Returns:
      key for column
    • setRowKey

      public Dataset setRowKey(int row, Comparable key)
      Sets the key for row with index row to key
      Parameters:
      row - row index
      key - key for row
      Returns:
      this dataset
      See Also:
    • setColumnKey

      public Dataset setColumnKey(int col, Comparable key)
      Sets the key for column with index column to key
      Parameters:
      col - column index
      key - key for column
      Returns:
      this dataset
      See Also:
    • setHistogramBins

      public Dataset setHistogramBins(int col, double min, double max, int count)
    • setHistogramBins

      public Dataset setHistogramBins(int col, List<HistogramBin> bins)
    • show

      public void show(Context ctx)
      Specified by:
      show in interface Showable
    • export

      public static void export(Item item, Object info, Context context)
    • export

      public void export(FileWriter file, String separator)
      Writes the data of this data set to the indicated file.
      Parameters:
      file -
      separator - between the items of a column
    • showInPanel

      public void showInPanel(Panel panel)
    • export

      public void export(StringBuffer sb, String separator)