de.erichseifert.gral.data
Class DataSeries

java.lang.Object
  extended by de.erichseifert.gral.data.AbstractDataSource
      extended by de.erichseifert.gral.data.DataSeries
All Implemented Interfaces:
DataListener, DataSource, Iterable<Number>

public class DataSeries
extends AbstractDataSource
implements DataListener

Class that represents a view on several columns of a DataSource.

See Also:
DataSource

Constructor Summary
DataSeries(DataSource data, int... cols)
          Constructor without name.
DataSeries(String name, DataSource data, int... cols)
          Constructor.
 
Method Summary
 void dataChanged(DataSource data)
          Method that is invoked by objects that provide support for DataListeners.
 Number get(int col, int row)
          Returns the row with the specified index.
 int getColumnCount()
          Returns the number of columns of the data source.
 String getName()
          Returns the name of this series.
 int getRowCount()
          Returns the number of rows of the data source.
 void setName(String name)
          Sets the name of this series.
 String toString()
           
 
Methods inherited from class de.erichseifert.gral.data.AbstractDataSource
addDataListener, getColumn, getRow, getStatistics, iterator, removeDataListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataSeries

public DataSeries(DataSource data,
                  int... cols)
Constructor without name. The first column will be column 0, the second column 1 and so on, whereas the value of the specified columns is the column number in the DataSource.

Parameters:
data - Data source
cols - Column numbers

DataSeries

public DataSeries(String name,
                  DataSource data,
                  int... cols)
Constructor. The first column will be column 0, the second column 1 and so on, whereas the value of the specified columns is the column number in the DataSource.

Parameters:
name - Descriptive name
data - Data source
cols - Column numbers
Method Detail

getName

public String getName()
Returns the name of this series.

Returns:
a name string

setName

public void setName(String name)
Sets the name of this series.

Parameters:
name - name to be set

get

public Number get(int col,
                  int row)
Description copied from interface: DataSource
Returns the row with the specified index.

Specified by:
get in interface DataSource
Parameters:
col - index of the column to return
row - index of the row to return
Returns:
the specified value of the data cell

getColumnCount

public int getColumnCount()
Description copied from interface: DataSource
Returns the number of columns of the data source.

Specified by:
getColumnCount in interface DataSource
Returns:
number of columns in the data source.

getRowCount

public int getRowCount()
Description copied from interface: DataSource
Returns the number of rows of the data source.

Specified by:
getRowCount in interface DataSource
Returns:
number of rows in the data source.

dataChanged

public void dataChanged(DataSource data)
Description copied from interface: DataListener
Method that is invoked by objects that provide support for DataListeners.

Specified by:
dataChanged in interface DataListener
Parameters:
data - data that has changed

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009-2010. All Rights Reserved.