Package com.mckoi.database
Class FilterTable
- java.lang.Object
-
- com.mckoi.database.Table
-
- com.mckoi.database.FilterTable
-
- All Implemented Interfaces:
TableDataSource
- Direct Known Subclasses:
ReferenceTable,SubsetColumnTable
public class FilterTable extends Table
A table that is a filter for another table. By default, all Table methods are implemented to call the parent. This class should be used when we want to implement a Table filter of some kind. For example, a filter for specific columns, or even rows, etc.NOTE: For efficiency reasons, this will store SelectableScheme objects generated by the parent like VirtualTable.
- Author:
- Tobias Downer
-
-
Field Summary
Fields Modifier and Type Field Description protected TableparentThe Table we are filtering the columns from.-
Fields inherited from class com.mckoi.database.Table
DEBUG_QUERY
-
-
Constructor Summary
Constructors Constructor Description FilterTable(Table parent)The Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intfindFieldName(Variable v)Given a fully qualified variable field name, ie.TObjectgetCellContents(int column, int row)Returns an object that represents the information in the given cell in the table.intgetColumnCount()Returns the number of columns in the table.DatabasegetDatabase()Returns the parent Database object.DataTableDefgetDataTableDef()Returns a DataTableDef object that defines the name of the table and the layout of the columns of the table.protected TablegetParent()Returns the parent table.VariablegetResolvedVariable(int column)Returns a fully qualified Variable object that represents the name of the column at the given index.intgetRowCount()Returns the number of rows stored in the table.booleanhasRootsLocked()Returns true if the table has its row roots locked (via the lockRoot(int) method.voidlockRoot(int lock_key)Locks the root table(s) of this table so that it is impossible to overwrite the underlying rows that may appear in this table.voidprintGraph(java.io.PrintStream out, int indent)Prints a graph of the table hierarchy to the stream.RowEnumerationrowEnumeration()Returns an Enumeration of the rows in this table.voidunlockRoot(int lock_key)Unlocks the root tables so that the underlying rows may once again be used if they are not locked and have been removed.-
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
-
-
-
-
Field Detail
-
parent
protected Table parent
The Table we are filtering the columns from.
-
-
Constructor Detail
-
FilterTable
public FilterTable(Table parent)
The Constructor.
-
-
Method Detail
-
getParent
protected Table getParent()
Returns the parent table.
-
getDatabase
public Database getDatabase()
Returns the parent Database object.- Specified by:
getDatabasein classTable
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the table.- Specified by:
getColumnCountin classTable
-
getRowCount
public int getRowCount()
Returns the number of rows stored in the table.- Specified by:
getRowCountin interfaceTableDataSource- Specified by:
getRowCountin classTable
-
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:
findFieldNamein classTable
-
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:
getResolvedVariablein classTable
-
getCellContents
public TObject getCellContents(int column, int row)
Returns an object that represents the information in the given cell in the table. This will generally be an expensive algorithm, so calls to it should be kept to a minimum. Note that the offset between two rows is not necessarily 1.- Specified by:
getCellContentsin interfaceTableDataSource- Specified by:
getCellContentsin classTable
-
rowEnumeration
public RowEnumeration rowEnumeration()
Returns an Enumeration of the rows in this table. The Enumeration is a fast way of retrieving consequtive rows in the table.- Specified by:
rowEnumerationin interfaceTableDataSource- Specified by:
rowEnumerationin classTable
-
getDataTableDef
public DataTableDef getDataTableDef()
Returns a DataTableDef object that defines the name of the table and the layout of the columns of the table. Note that for tables that are joined with other tables, the table name and schema for this object become mangled. For example, a table called 'PERSON' joined with a table called 'MUSIC' becomes a table called 'PERSON#MUSIC' in a null schema.- Specified by:
getDataTableDefin interfaceTableDataSource- Specified by:
getDataTableDefin classTable
-
lockRoot
public void lockRoot(int lock_key)
Locks the root table(s) of this table so that it is impossible to overwrite the underlying rows that may appear in this table. This is used when cells in the table need to be accessed 'outside' the lock. So we may have late access to cells in the table. 'lock_key' is a given key that will also unlock the root table(s). NOTE: This is nothing to do with the 'LockingMechanism' object.
-
unlockRoot
public void unlockRoot(int lock_key)
Unlocks the root tables so that the underlying rows may once again be used if they are not locked and have been removed. This should be called some time after the rows have been locked.- Specified by:
unlockRootin classTable
-
hasRootsLocked
public boolean hasRootsLocked()
Returns true if the table has its row roots locked (via the lockRoot(int) method.- Specified by:
hasRootsLockedin classTable
-
printGraph
public void printGraph(java.io.PrintStream out, int indent)Prints a graph of the table hierarchy to the stream.- Overrides:
printGraphin classTable
-
-