public abstract class AbstractDataSource extends java.lang.Object implements DataSource, java.io.Serializable
DataSource
interface.
This class provides access to statistical information,
administration and notification of listeners and supports
iteration of data values.Constructor and Description |
---|
AbstractDataSource(java.lang.Class<? extends java.lang.Comparable<?>>... types)
Initializes a new instance with the specified number of columns and
column types.
|
Modifier and Type | Method and Description |
---|---|
void |
addDataListener(DataListener dataListener)
Adds the specified
DataListener to this data source. |
Column |
getColumn(int col)
Returns the column with the specified index.
|
int |
getColumnCount()
Returns the number of columns of the data source.
|
java.lang.Class<? extends java.lang.Comparable<?>>[] |
getColumnTypes()
Returns the data types of all columns.
|
Row |
getRow(int row)
Returns the row with the specified index.
|
Statistics |
getStatistics()
Retrieves a object instance that contains various statistical
information on the current data source.
|
boolean |
isColumnNumeric(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.
|
protected void |
notifyDataAdded(DataChangeEvent... events)
Notifies all registered listeners that data values have been added.
|
protected void |
notifyDataRemoved(DataChangeEvent... events)
Notifies all registered listeners that data values have been removed.
|
protected void |
notifyDataUpdated(DataChangeEvent... events)
Notifies all registered listeners that data values have changed.
|
void |
removeDataListener(DataListener dataListener)
Removes the specified
DataListener from this data source. |
protected void |
setColumnTypes(java.lang.Class<? extends java.lang.Comparable<?>>... types)
Sets the data types of all columns.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, getRowCount
public AbstractDataSource(java.lang.Class<? extends java.lang.Comparable<?>>... types)
types
- type for each columnpublic Statistics getStatistics()
getStatistics
in interface DataSource
public void addDataListener(DataListener dataListener)
DataListener
to this data source.addDataListener
in interface DataSource
dataListener
- listener to be added.public void removeDataListener(DataListener dataListener)
DataListener
from this data source.removeDataListener
in interface DataSource
dataListener
- listener to be removed.public java.util.Iterator<java.lang.Comparable<?>> iterator()
iterator
in interface java.lang.Iterable<java.lang.Comparable<?>>
protected void notifyDataAdded(DataChangeEvent... events)
events
- Event objects describing all values that have been added.protected void notifyDataRemoved(DataChangeEvent... events)
events
- Event objects describing all values that have been removed.protected void notifyDataUpdated(DataChangeEvent... events)
events
- Event objects describing all values that have changed.public Column getColumn(int col)
getColumn
in interface DataSource
col
- index of the column to returnpublic int getColumnCount()
getColumnCount
in interface DataSource
public java.lang.Class<? extends java.lang.Comparable<?>>[] getColumnTypes()
getColumnTypes
in interface DataSource
public boolean isColumnNumeric(int columnIndex)
isColumnNumeric
in interface DataSource
columnIndex
- Index of the column to test.true
if the column is numeric, otherwise false
.protected void setColumnTypes(java.lang.Class<? extends java.lang.Comparable<?>>... types)
types
- Data types.public Row getRow(int row)
getRow
in interface DataSource
row
- Index of the row to return