Package com.mckoi.database
Class SubsetColumnTable
java.lang.Object
com.mckoi.database.Table
com.mckoi.database.FilterTable
com.mckoi.database.SubsetColumnTable
- All Implemented Interfaces:
RootTable
,TableDataSource
This object is a filter that sits atop a Table object. Its purpose is to
only provide a view of the columns that are required. In a Select
query we may create a query with only the subset of columns that were
originally in the table set. This object allows us to provide an
interface to only the columns that the Table is allowed to access.
This method implements RootTable which means a union operation will not decend further past this table when searching for the roots.
- Author:
- Tobias Downer
-
Field Summary
Fields inherited from class com.mckoi.database.FilterTable
parent
Fields inherited from class com.mckoi.database.Table
DEBUG_QUERY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Given a fully qualified variable field name, ie.final TObject
getCellContents
(int column, int row) Returns an object that represents the information in the given cell in the table.int
Returns the number of columns in the table.Returns the DataTableDef object that describes the columns and name of this table.getResolvedVariable
(int column) Returns a fully qualified Variable object that represents the name of the column at the given index.void
setColumnMap
(int[] mapping, Variable[] aliases) Adds a column map into this table.toString()
Returns a string that represents this table.boolean
typeEquals
(RootTable table) This function is used to check that two tables are identical.Methods inherited from class com.mckoi.database.FilterTable
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, union
-
Constructor Details
-
SubsetColumnTable
The Constructor.
-
-
Method Details
-
setColumnMap
Adds a column map into this table. The int array contains a map to the column in the parent object that we want the column number to reference. For example, to select columns 4, 8, 1, 2 into this new table, the array would be { 4, 8, 1, 2 }. -
getColumnCount
public int getColumnCount()Returns the number of columns in the table.- Overrides:
getColumnCount
in classFilterTable
-
findFieldName
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 classFilterTable
-
getDataTableDef
Returns the DataTableDef object that describes the columns and name of this table. For a SubsetColumnTable object, this returns the columns that were mapped via the 'setColumnMap' method.- Specified by:
getDataTableDef
in interfaceTableDataSource
- Overrides:
getDataTableDef
in classFilterTable
-
getResolvedVariable
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 classFilterTable
-
getCellContents
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:
getCellContents
in interfaceTableDataSource
- Overrides:
getCellContents
in classFilterTable
-
typeEquals
This function is used to check that two tables are identical. This is used in operations like 'union' that need to determine that the roots are infact of the same type.- Specified by:
typeEquals
in interfaceRootTable
-
toString
Returns a string that represents this table.
-