com.mckoi.database
Interface TableDataSource

All Known Subinterfaces:
MutableTableDataSource
All Known Implementing Classes:
AbstractDataTable, CompositeTable, DataTable, DataTableFilter, DefaultDataTable, FilterTable, FunctionTable, GTPrivMapDataSource, GTSQLTypeInfoDataSource, JoinedTable, NaturallyJoinedTable, ReferenceTable, SubsetColumnTable, Table, TemporaryTable, VirtualTable

public interface TableDataSource

This interface represents the source of data in a table. This is an abstraction that is used to read data from within a table.

The entire contents of a table can be completely represented by implementations of this interface.

Author:
Tobias Downer

Method Summary
 TObject getCellContents(int column, int row)
          Returns an object that represents the information in the given cell in the table.
 SelectableScheme getColumnScheme(int column)
          Returns the SelectableScheme that we use as an index for rows in the given column of this source.
 DataTableDef getDataTableDef()
          Returns a DataTableDef object that defines the layout of the table that this data is in.
 int getRowCount()
          Returns the number of rows in this data source.
 TransactionSystem getSystem()
          Returns the TransactionSystem object that describes global properties about the data source that generated this object.
 RowEnumeration rowEnumeration()
          Returns an iterator that is used to sequentually step through all valid rows in this source.
 

Method Detail

getSystem

TransactionSystem getSystem()
Returns the TransactionSystem object that describes global properties about the data source that generated this object.


getDataTableDef

DataTableDef getDataTableDef()
Returns a DataTableDef object that defines the layout of the table that this data is in.

This may return 'null' if there is no table definition.


getRowCount

int getRowCount()
Returns the number of rows in this data source.

NOTE: Returns 'n' - getCellContents(column, row) is not necessarily valid for row = [0..n]. Use 'rowEnumerator' to generate an iterator for valid row values over this data source.


rowEnumeration

RowEnumeration rowEnumeration()
Returns an iterator that is used to sequentually step through all valid rows in this source. The iterator is guarenteed to return exactly 'getRowCount' elements. The row elements returned by this iterator are used in 'getCellContents' in the 'row' parameter.

Note that this object is only defined if entries in the table are not added/remove during the lifetime of this iterator. If entries are added or removed from the table while this iterator is open, then calls to 'nextRowIndex' will be undefined.


getColumnScheme

SelectableScheme getColumnScheme(int column)
Returns the SelectableScheme that we use as an index for rows in the given column of this source. The SelectableScheme is used to determine the relationship between cells in a column.

ISSUE: The scheme returned here should not have the 'insert' or 'remove' methods called (ie. it should be considered immutable). Perhaps we should make a MutableSelectableScheme interface to guarentee this constraint.


getCellContents

TObject getCellContents(int column,
                        int row)
Returns an object that represents the information in the given cell in the table. This may be an expensive operation, so calls to it should be kept to a minimum. Note that the offset between two rows is not necessarily 1. Use 'rowEnumeration' to create a row iterator.