Package com.mckoi.database
Class DataTableFilter
- java.lang.Object
-
- com.mckoi.database.Table
-
- com.mckoi.database.AbstractDataTable
-
- com.mckoi.database.DataTableFilter
-
- All Implemented Interfaces:
RootTable,TableDataSource
public class DataTableFilter extends AbstractDataTable
This object sits on top of a DataTable object filtering out certain types of calls. We could use this object to implement a ReferenceTable which can be used to declare a new table name with a DataTable type. We also use this object to implement a filter for column removals.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.mckoi.database.Table
Table.TableVariableResolver
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractDataTableparentThe parent DataTable object.-
Fields inherited from class com.mckoi.database.Table
DEBUG_QUERY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDataTableFilter(AbstractDataTable table)The Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddDataTableListener(DataTableListener listener)Adds a DataTableListener to the DataTable objects at the root of this table tree hierarchy.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 Database context for this filtered table.DataTableDefgetDataTableDef()Returns a DataTableDef object that defines the name of the table and the layout of the columns of the 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.(package private) SelectableSchemegetSelectableSchemeFor(int column, int original_column, Table table)Returns a SelectableScheme for the given column in the given VirtualTable row domain.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.(package private) voidremoveDataTableListener(DataTableListener listener)Removes a DataTableListener from the DataTable objects at the root of this table tree hierarchy.(package private) RawTableInformationresolveToRawTable(RawTableInformation info)Return the list of DataTable and row sets that make up the raw information in this table.RowEnumerationrowEnumeration()Returns an Enumeration of the rows in this table.(package private) voidsetToRowTableDomain(int column, IntegerVector row_set, TableDataSource ancestor)Given a set, this trickles down through the Table hierarchy resolving the given row_set to a form that the given ancestor understands.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.AbstractDataTable
getTableName, toString, typeEquals
-
Methods inherited from class com.mckoi.database.Table
all, allColumnMatchesValue, allRowsIn, allRowsNotIn, 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, getVariableResolver, join, orderByColumn, orderByColumn, orderByColumn, orderByColumns, orderedRowList, outside, printGraph, rangeSelect, selectAll, selectAll, selectFirst, selectFromPattern, selectFromRegex, selectLast, selectRange, selectRest, selectRows, selectRows, selectRows, simpleJoin, simpleSelect, singleRowSelect, toMap, union
-
-
-
-
Field Detail
-
parent
protected AbstractDataTable parent
The parent DataTable object.
-
-
Constructor Detail
-
DataTableFilter
protected DataTableFilter(AbstractDataTable table)
The Constructor. A filter can only sit on top of a DataTable or DataTableFilter table. ISSUE: we could make an interface for this. This is a bit of a hack.
-
-
Method Detail
-
getDatabase
public Database getDatabase()
Returns the Database context for this filtered table.- Specified by:
getDatabasein classTable
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the table.- Specified by:
getColumnCountin classTable
-
getRowCount
public final 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
-
getSelectableSchemeFor
final SelectableScheme getSelectableSchemeFor(int column, int original_column, Table table)
Returns a SelectableScheme for the given column in the given VirtualTable row domain. Slight Hack: When we are asking for a selectable scheme for a reference table, we must defer the 'table' variable to the parent.- Specified by:
getSelectableSchemeForin classTable
-
setToRowTableDomain
final void setToRowTableDomain(int column, IntegerVector row_set, TableDataSource ancestor)Given a set, this trickles down through the Table hierarchy resolving the given row_set to a form that the given ancestor understands. Say you give the set { 0, 1, 2, 3, 4, 5, 6 }, this function may check down three levels and return a new 7 element set with the rows fully resolved to the given ancestors domain.Slight Hack: When we are asking for a selectable scheme for a reference table, we must defer the 'table' variable to the parent.
- Specified by:
setToRowTableDomainin classTable
-
resolveToRawTable
final RawTableInformation resolveToRawTable(RawTableInformation info)
Return the list of DataTable and row sets that make up the raw information in this table. This is identical to the DataTable method except it puts this table as the owner of the row set.- Specified by:
resolveToRawTablein classTable
-
getCellContents
public final 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 final 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
-
addDataTableListener
void addDataTableListener(DataTableListener listener)
Adds a DataTableListener to the DataTable objects at the root of this table tree hierarchy. If this table represents the join of a number of tables then the DataTableListener is added to all the DataTable objects at the root.A DataTableListener is notified of all modifications to the raw entries of the table. This listener can be used for detecting changes in VIEWs, for triggers or for caching of common queries.
- Specified by:
addDataTableListenerin classTable
-
removeDataTableListener
void removeDataTableListener(DataTableListener listener)
Removes a DataTableListener from the DataTable objects at the root of this table tree hierarchy. If this table represents the join of a number of tables, then the DataTableListener is removed from all the DataTable objects at the root.- Specified by:
removeDataTableListenerin 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
-
-