de.erichseifert.gral.data
Class AbstractDataSource
- java.lang.Object
-
- de.erichseifert.gral.data.AbstractDataSource
-
- All Implemented Interfaces:
- DataSource, java.io.Serializable, java.lang.Iterable<java.lang.Comparable<?>>
- Direct Known Subclasses:
- AbstractHistogram2D, DataSeries, DataTable, DummyData, EnumeratedData, Filter2D, JdbcData, RowSubset
public abstract class AbstractDataSource extends java.lang.Object implements DataSource, java.io.Serializable
Abstract implementation of theDataSourceinterface. This class provides access to statistical information, administration and notification of listeners and supports iteration of data values.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description AbstractDataSource()AbstractDataSource(java.lang.Class<? extends java.lang.Comparable<?>>... types)Initializes a new instance with the specified number of columns and column types.AbstractDataSource(Column... remainingColumns)AbstractDataSource(java.lang.String name, java.lang.Class<? extends java.lang.Comparable<?>>... types)Initializes a new instance with the specified name, number of columns, and column types.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddDataListener(DataListener dataListener)Adds the specifiedDataListenerto this data source.Column<?>getColumn(int col)Returns the column with the specified index.intgetColumnCount()Returns the number of columns of the data source.DataSourcegetColumnStatistics(java.lang.String key)java.lang.Class<? extends java.lang.Comparable<?>>[]getColumnTypes()Returns the data types of all columns.java.lang.StringgetName()Returns the name of this series.RecordgetRecord(int row)RowgetRow(int row)Returns the row with the specified index.DataSourcegetRowStatistics(java.lang.String key)StatisticsgetStatistics()Retrieves a object instance that contains various statistical information on the current data source.booleanisColumnNumeric(int columnIndex)Returns whether the column at the specified index contains numbers.java.util.Iterator<java.lang.Comparable<?>>iterator()Returns an iterator over a set of elements of type T.voidremoveDataListener(DataListener dataListener)Removes the specifiedDataListenerfrom this data source.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.erichseifert.gral.data.DataSource
get, getRowCount
-
-
-
-
Constructor Detail
-
AbstractDataSource
public AbstractDataSource()
-
AbstractDataSource
public AbstractDataSource(java.lang.String name, java.lang.Class<? extends java.lang.Comparable<?>>... types)Initializes a new instance with the specified name, number of columns, and column types.- Parameters:
name- name of the DataSourcetypes- type for each column
-
AbstractDataSource
public AbstractDataSource(java.lang.Class<? extends java.lang.Comparable<?>>... types)
Initializes a new instance with the specified number of columns and column types.- Parameters:
types- type for each column
-
AbstractDataSource
public AbstractDataSource(Column... remainingColumns)
-
-
Method Detail
-
getStatistics
public Statistics getStatistics()
Retrieves a object instance that contains various statistical information on the current data source.- Specified by:
getStatisticsin interfaceDataSource- Returns:
- statistical information
-
getColumnStatistics
public DataSource getColumnStatistics(java.lang.String key)
- Specified by:
getColumnStatisticsin interfaceDataSource
-
getRowStatistics
public DataSource getRowStatistics(java.lang.String key)
- Specified by:
getRowStatisticsin interfaceDataSource
-
addDataListener
public void addDataListener(DataListener dataListener)
Adds the specifiedDataListenerto this data source.- Specified by:
addDataListenerin interfaceDataSource- Parameters:
dataListener- listener to be added.
-
removeDataListener
public void removeDataListener(DataListener dataListener)
Removes the specifiedDataListenerfrom this data source.- Specified by:
removeDataListenerin interfaceDataSource- Parameters:
dataListener- listener to be removed.
-
iterator
public java.util.Iterator<java.lang.Comparable<?>> iterator()
Returns an iterator over a set of elements of type T.- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.Comparable<?>>- Returns:
- an Iterator.
-
getColumn
public Column<?> getColumn(int col)
Returns the column with the specified index.- Specified by:
getColumnin interfaceDataSource- Parameters:
col- index of the column to return- Returns:
- the specified column of the data source
-
getName
public java.lang.String getName()
Description copied from interface:DataSourceReturns the name of this series.- Specified by:
getNamein interfaceDataSource- Returns:
- a name string
-
getRecord
public Record getRecord(int row)
- Specified by:
getRecordin interfaceDataSource
-
getColumnCount
public int getColumnCount()
Returns the number of columns of the data source.- Specified by:
getColumnCountin interfaceDataSource- Returns:
- number of columns in the data source.
-
getColumnTypes
public java.lang.Class<? extends java.lang.Comparable<?>>[] getColumnTypes()
Returns the data types of all columns.- Specified by:
getColumnTypesin interfaceDataSource- Returns:
- The data types of all column in the data source
-
isColumnNumeric
public boolean isColumnNumeric(int columnIndex)
Returns whether the column at the specified index contains numbers.- Specified by:
isColumnNumericin interfaceDataSource- Parameters:
columnIndex- Index of the column to test.- Returns:
trueif the column is numeric, otherwisefalse.
-
getRow
public Row getRow(int row)
Returns the row with the specified index.- Specified by:
getRowin interfaceDataSource- Parameters:
row- Index of the row to return- Returns:
- the Specified row of the data source
-
-
DataMelt 3.0 © DataMelt by jWork.ORG