com.mckoi.database
Class ReferenceTable

java.lang.Object
  extended by com.mckoi.database.Table
      extended by com.mckoi.database.FilterTable
          extended by com.mckoi.database.ReferenceTable
All Implemented Interfaces:
RootTable, TableDataSource

public final class ReferenceTable
extends FilterTable
implements RootTable

This is an implementation of a Table that references a DataTable as its parent. This is a one-to-one relationship unlike the VirtualTable class which is a one-to-many relationship.

The entire purpose of this class is as a filter. We can use it to rename a DataTable class to any domain we feel like. This allows us to generate unique column names.

For example, say we need to join the same table. We can use this method to ensure that the newly joined table won't have duplicate column names.

This object implements RootTable.

Author:
Tobias Downer

Field Summary
 
Fields inherited from class com.mckoi.database.FilterTable
parent
 
Fields inherited from class com.mckoi.database.Table
DEBUG_QUERY
 
Method Summary
 int findFieldName(Variable v)
          Given a fully qualified variable field name, ie.
 DataTableDef getDataTableDef()
          Returns the 'modified' DataTableDef object for this reference.
 Variable getResolvedVariable(int column)
          Returns a fully qualified Variable object that represents the name of the column at the given index.
 TableName getTableName()
          Filters the name of the table.
 boolean typeEquals(RootTable table)
          This is function is used to check that two root tables are identical.
 
Methods inherited from class com.mckoi.database.FilterTable
getCellContents, getColumnCount, getDatabase, getParent, getRowCount, hasRootsLocked, lockRoot, printGraph, rowEnumeration, unlockRoot
 
Methods inherited from class com.mckoi.database.Table
all, allColumnMatchesValue, any, columnContainsCell, columnContainsValue, columnMatchesValue, columnMerge, compareCells, Debug, distinct, distinct, dumpTo, emptySelect, exhaustiveSelect, fastFindFieldName, getColumnDefAt, getColumnScheme, getFirstCellContent, getFirstCellContent, getLastCellContent, getLastCellContent, getSingleCellContent, getSingleCellContent, getSystem, getTableAccessState, getTTypeForColumn, getTTypeForColumn, join, orderByColumn, orderByColumn, orderByColumn, orderByColumns, orderedRowList, outside, rangeSelect, selectAll, selectAll, selectFirst, selectLast, selectRange, selectRest, simpleJoin, simpleSelect, singleRowSelect, toMap, toString, union
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getTableName

public TableName getTableName()
Filters the name of the table. This returns the declared name of the table.


getDataTableDef

public DataTableDef getDataTableDef()
Returns the 'modified' DataTableDef object for this reference.

Specified by:
getDataTableDef in interface TableDataSource
Overrides:
getDataTableDef in class FilterTable

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.

Overrides:
findFieldName in class FilterTable

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")

Overrides:
getResolvedVariable in class FilterTable

typeEquals

public boolean typeEquals(RootTable table)
Description copied from interface: RootTable
This is function is used to check that two root tables are identical. This is used if we need to chect that the form of the table is the same. Such as in a union operation, when we can only union two tables with the identical columns.

Specified by:
typeEquals in interface RootTable