com.mckoi.database
Class DefaultDataTable

java.lang.Object
  extended by com.mckoi.database.Table
      extended by com.mckoi.database.AbstractDataTable
          extended by com.mckoi.database.DefaultDataTable
All Implemented Interfaces:
RootTable, TableDataSource
Direct Known Subclasses:
DataTable, FunctionTable, TemporaryTable

public abstract class DefaultDataTable
extends AbstractDataTable

This represents a default implementation of a DataTable. It encapsulates information that is core to all DataTable objects. That is,

The table name, The description of the table fields, A set of SelectableScheme objects to describe row relations, A counter for the number of rows in the table.

There are two classes that extend this object. DataTable which is a DataTable that is a direct mapping to an internal table stored in the Database files. And TemporaryTable that contains information generated on the fly by the DBMS.

Author:
Tobias Downer

Field Summary
protected  int row_count
          The number of rows in the table.
 
Fields inherited from class com.mckoi.database.Table
DEBUG_QUERY
 
Method Summary
protected  void blankSelectableSchemes()
          Blanks all the column schemes in the table to an initial state.
protected  void blankSelectableSchemes(int type)
          Blanks all the column schemes in this table to a specific type of scheme.
protected  void clearColumnScheme(int column)
          Clears the SelectableScheme information for the given column.
 int findFieldName(Variable v)
          Given a fully qualified variable field name, ie.
 int getColumnCount()
          Returns the number of columns in the table.
 Database getDatabase()
          Returns the Database object this table is part of.
 Variable getResolvedVariable(int column)
          Returns a fully qualified Variable object that represents the name of the column at the given index.
protected  SelectableScheme getRootColumnScheme(int column)
          Returns the SelectableScheme for the given column.
 int getRowCount()
          Returns the number of rows stored in the table.
 
Methods inherited from class com.mckoi.database.AbstractDataTable
getTableName, toString, typeEquals
 
Methods inherited from class com.mckoi.database.Table
all, allColumnMatchesValue, any, columnContainsCell, columnContainsValue, columnMatchesValue, columnMerge, compareCells, Debug, distinct, distinct, dumpTo, emptySelect, exhaustiveSelect, fastFindFieldName, getCellContents, getColumnDefAt, getColumnScheme, getDataTableDef, getFirstCellContent, getFirstCellContent, getLastCellContent, getLastCellContent, getSingleCellContent, getSingleCellContent, getSystem, getTableAccessState, getTTypeForColumn, getTTypeForColumn, hasRootsLocked, join, lockRoot, orderByColumn, orderByColumn, orderByColumn, orderByColumns, orderedRowList, outside, printGraph, rangeSelect, rowEnumeration, selectAll, selectAll, selectFirst, selectLast, selectRange, selectRest, simpleJoin, simpleSelect, singleRowSelect, toMap, union, unlockRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

row_count

protected int row_count
The number of rows in the table.

Method Detail

getDatabase

public Database getDatabase()
Returns the Database object this table is part of.

Specified by:
getDatabase in class Table

getRootColumnScheme

protected SelectableScheme getRootColumnScheme(int column)
Returns the SelectableScheme for the given column. This is different from 'getColumnScheme(int column)' because this is designed to be overridden so derived classes can manage their own SelectableScheme sources.


clearColumnScheme

protected void clearColumnScheme(int column)
Clears the SelectableScheme information for the given column.


blankSelectableSchemes

protected void blankSelectableSchemes()
Blanks all the column schemes in the table to an initial state. This will make all schemes of type InsertSearch.

NOTE: The current default SelectableScheme type is InsertSearch. We may want to make this variable.


blankSelectableSchemes

protected void blankSelectableSchemes(int type)
Blanks all the column schemes in this table to a specific type of scheme. If Type = 0 then InsertSearch (fast but takes up memory - requires each insert and delete from the table to be logged). If type = 1 then BlindSearch (slower but uses no memory and doesn't require insert and delete to be logged).


getColumnCount

public int getColumnCount()
Returns the number of columns in the table.

Specified by:
getColumnCount in class Table

getRowCount

public int getRowCount()
Returns the number of rows stored in the table.

Specified by:
getRowCount in interface TableDataSource
Specified by:
getRowCount in class Table

getResolvedVariable

public Variable getResolvedVariable(int column)
Returns a fully qualified Variable object that represents the name of the column at the given index. For example, new Variable(new TableName("APP", "CUSTOMER"), "ID")

Specified by:
getResolvedVariable in class Table

findFieldName

public int findFieldName(Variable v)
Given a fully qualified variable field name, ie. 'APP.CUSTOMER.CUSTOMERID' this will return the column number the field is at. Returns -1 if the field does not exist in the table.

Specified by:
findFieldName in class Table