de.erichseifert.gral.data
Class DataSeries
- java.lang.Object
-
- de.erichseifert.gral.data.AbstractDataSource
-
- de.erichseifert.gral.data.DataSeries
-
- All Implemented Interfaces:
- DataListener, DataSource, java.io.Serializable, java.lang.Iterable<java.lang.Comparable<?>>
public class DataSeries extends AbstractDataSource implements DataListener
Class that represents a view on several columns of aDataSource.- See Also:
DataSource, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DataSeries(DataSource data, int... cols)Constructor without name.DataSeries(java.lang.String name, DataSource data, int... cols)Constructor that initializes a named data series.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddataAdded(DataSource source, DataChangeEvent... events)Method that is invoked when data has been added.voiddataRemoved(DataSource source, DataChangeEvent... events)Method that is invoked when data has been removed.voiddataUpdated(DataSource source, DataChangeEvent... events)Method that is invoked when data has been updated.java.lang.Comparable<?>get(int col, int row)Returns the row with the specified index.intgetColumnCount()Returns the number of columns of the data source.intgetRowCount()Returns the number of rows of the data source.java.lang.StringtoString()-
Methods inherited from class de.erichseifert.gral.data.AbstractDataSource
addDataListener, getColumn, getColumnStatistics, getColumnTypes, getName, getRecord, getRow, getRowStatistics, getStatistics, isColumnNumeric, iterator, removeDataListener
-
-
-
-
Constructor Detail
-
DataSeries
public DataSeries(DataSource data, int... cols)
Constructor without name. The first column will be column0, the second column1and so on, whereas the value of the specified columns is the column number in the data source.- Parameters:
data- Data sourcecols- Column numbers
-
DataSeries
public DataSeries(java.lang.String name, DataSource data, int... cols)Constructor that initializes a named data series. The first column will be column0, the second column1and so on, whereas the value of the specified columns is the column number in the data source.- Parameters:
name- Descriptive namedata- Data sourcecols- Column numbers
-
-
Method Detail
-
get
public java.lang.Comparable<?> get(int col, int row)Returns the row with the specified index.- Specified by:
getin interfaceDataSource- Parameters:
col- index of the column to returnrow- index of the row to return- Returns:
- the specified value of the data cell
-
getColumnCount
public int getColumnCount()
Description copied from class:AbstractDataSourceReturns the number of columns of the data source.- Specified by:
getColumnCountin interfaceDataSource- Overrides:
getColumnCountin classAbstractDataSource- Returns:
- number of columns in the data source.
-
getRowCount
public int getRowCount()
Returns the number of rows of the data source.- Specified by:
getRowCountin interfaceDataSource- Returns:
- number of rows in the data source.
-
dataAdded
public void dataAdded(DataSource source, DataChangeEvent... events)
Method that is invoked when data has been added. This method is invoked by objects that provide support forDataListeners and should not be called manually.- Specified by:
dataAddedin interfaceDataListener- Parameters:
source- Data source that has been changed.events- Optional event object describing the data values that have been added.
-
dataUpdated
public void dataUpdated(DataSource source, DataChangeEvent... events)
Method that is invoked when data has been updated. This method is invoked by objects that provide support forDataListeners and should not be called manually.- Specified by:
dataUpdatedin interfaceDataListener- Parameters:
source- Data source that has been changed.events- Optional event object describing the data values that have been updated.
-
dataRemoved
public void dataRemoved(DataSource source, DataChangeEvent... events)
Method that is invoked when data has been removed. This method is invoked by objects that provide support forDataListeners and should not be called manually.- Specified by:
dataRemovedin interfaceDataListener- Parameters:
source- Data source that has been changed.events- Optional event object describing the data values that have been removed.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG