de.erichseifert.gral.data
Class EnumeratedData
- java.lang.Object
-
- de.erichseifert.gral.data.AbstractDataSource
-
- de.erichseifert.gral.data.EnumeratedData
-
- All Implemented Interfaces:
- DataListener, DataSource, java.io.Serializable, java.lang.Iterable<java.lang.Comparable<?>>
public class EnumeratedData extends AbstractDataSource implements DataListener
Class that creates a new data source which adds a leading column containing the row number.
Example which creates a two column data source from a one column histogram:
DataSource hist = new Histogram2D(data, Orientation.HORIZONTAL, 10); DataSource hist2d = new EnumeratedData(hist);
- See Also:
DataSource, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description EnumeratedData(DataSource original)Initializes a new data source based on an original data source which will contain an additional column which enumerates all rows.EnumeratedData(DataSource original, double offset, double steps)Initializes a new data source based on an original data source which will contain an additional column which enumerates all rows.
-
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 added.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.intgetRowCount()Returns the number of rows of the data source.-
Methods inherited from class de.erichseifert.gral.data.AbstractDataSource
addDataListener, getColumn, getColumnCount, getColumnStatistics, getColumnTypes, getName, getRecord, getRow, getRowStatistics, getStatistics, isColumnNumeric, iterator, removeDataListener
-
-
-
-
Constructor Detail
-
EnumeratedData
public EnumeratedData(DataSource original, double offset, double steps)
Initializes a new data source based on an original data source which will contain an additional column which enumerates all rows. The enumeration will start at a specified offset and will have a specified step size.- Parameters:
original- Original data source.offset- Offset of enumerationsteps- Scaling of enumeration
-
EnumeratedData
public EnumeratedData(DataSource original)
Initializes a new data source based on an original data source which will contain an additional column which enumerates all rows.- Parameters:
original- Original data source.
-
-
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
-
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 added. 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.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG