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 Histogram1D(data, Orientation.HORIZONTAL, 10); DataSource hist2d = new EnumeratedData(hist);
DataSource
,
Serialized FormConstructor 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.
|
Modifier and Type | Method and Description |
---|---|
void |
dataAdded(DataSource source,
DataChangeEvent... events)
Method that is invoked when data has been added.
|
void |
dataRemoved(DataSource source,
DataChangeEvent... events)
Method that is invoked when data has been added.
|
void |
dataUpdated(DataSource source,
DataChangeEvent... events)
Method that is invoked when data has been updated.
|
Comparable<?> |
get(int col,
int row)
Returns the row with the specified index.
|
int |
getRowCount()
Returns the number of rows of the data source.
|
addDataListener, getColumn, getColumnCount, getColumnTypes, getRow, getStatistics, isColumnNumeric, iterator, notifyDataAdded, notifyDataRemoved, notifyDataUpdated, removeDataListener, setColumnTypes
public EnumeratedData(DataSource original, double offset, double steps)
original
- Original data source.offset
- Offset of enumerationsteps
- Scaling of enumerationpublic EnumeratedData(DataSource original)
original
- Original data source.public Comparable<?> get(int col, int row)
get
in interface DataSource
col
- index of the column to returnrow
- index of the row to returnpublic int getRowCount()
getRowCount
in interface DataSource
public void dataAdded(DataSource source, DataChangeEvent... events)
DataListener
s and should not be called manually.dataAdded
in interface DataListener
source
- Data source that has been changed.events
- Optional event object describing the data values that
have been added.public void dataUpdated(DataSource source, DataChangeEvent... events)
DataListener
s and should not be called manually.dataUpdated
in interface DataListener
source
- Data source that has been changed.events
- Optional event object describing the data values that
have been updated.public void dataRemoved(DataSource source, DataChangeEvent... events)
DataListener
s and should not be called manually.dataRemoved
in interface DataListener
source
- Data source that has been changed.events
- Optional event object describing the data values that
have been removed.Copyright © 2009-2013. All Rights Reserved.