Package com.mckoi.database
Class NaturallyJoinedTable
- java.lang.Object
-
- com.mckoi.database.Table
-
- com.mckoi.database.JoinedTable
-
- com.mckoi.database.NaturallyJoinedTable
-
- All Implemented Interfaces:
TableDataSource
public final class NaturallyJoinedTable extends JoinedTable
A table that is the cartesian product of two tables. This provides better memory-use and efficiency than a materialized table backed by a VirtualTable.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.mckoi.database.Table
Table.TableVariableResolver
-
-
Field Summary
Fields Modifier and Type Field Description private booleanleft_is_simple_enumprivate intleft_row_countThe row counts of the left and right tables.private IntegerVectorleft_setThe lookup row set for the left and right tables.private booleanright_is_simple_enumprivate intright_row_countThe row counts of the left and right tables.private IntegerVectorright_setThe lookup row set for the left and right tables.-
Fields inherited from class com.mckoi.database.JoinedTable
column_filter, column_scheme, column_table, reference_list
-
Fields inherited from class com.mckoi.database.Table
DEBUG_QUERY
-
-
Constructor Summary
Constructors Constructor Description NaturallyJoinedTable(Table left, Table right)Constructs the table.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static IntegerVectorcreateLookupRowList(Table t)Creates a lookup list for rows in the given table.private intgetLeftRowIndex(int row_index)Given a row index between 0 and left table row count, this will return a row index into the left table's row domain.private intgetRightRowIndex(int row_index)Given a row index between 0 and right table row count, this will return a row index into the right table's row domain.intgetRowCount()Returns the number of rows stored in the table.protected voidresolveAllRowsForTableAt(IntegerVector row_set, int table_num)Given an IntegerVector that represents a list of pointers to rows in this table, this resolves the rows to row indexes in the given parent table.protected intresolveRowForTableAt(int row_number, int table_num)Given a row and a table index (to a parent reference table), this will return the row index in the given parent table for the given row.-
Methods inherited from class com.mckoi.database.JoinedTable
addDataTableListener, findFieldName, getCellContents, getColumnCount, getDatabase, getDataTableDef, getReferenceTables, getResolvedVariable, getSelectableSchemeFor, hasRootsLocked, init, lockRoot, optimisedPostSet, printGraph, removeDataTableListener, resolveToRawTable, resolveToRawTable, rowEnumeration, setToRowTableDomain, unlockRoot
-
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, rangeSelect, selectAll, selectAll, selectFirst, selectFromPattern, selectFromRegex, selectLast, selectRange, selectRest, selectRows, selectRows, selectRows, simpleJoin, simpleSelect, singleRowSelect, toMap, toString, union
-
-
-
-
Field Detail
-
left_row_count
private final int left_row_count
The row counts of the left and right tables.
-
right_row_count
private final int right_row_count
The row counts of the left and right tables.
-
left_set
private final IntegerVector left_set
The lookup row set for the left and right tables. Basically, these point to each row in either the left or right tables.
-
right_set
private final IntegerVector right_set
The lookup row set for the left and right tables. Basically, these point to each row in either the left or right tables.
-
left_is_simple_enum
private final boolean left_is_simple_enum
-
right_is_simple_enum
private final boolean right_is_simple_enum
-
-
Method Detail
-
createLookupRowList
private static IntegerVector createLookupRowList(Table t)
Creates a lookup list for rows in the given table.
-
getLeftRowIndex
private int getLeftRowIndex(int row_index)
Given a row index between 0 and left table row count, this will return a row index into the left table's row domain.
-
getRightRowIndex
private int getRightRowIndex(int row_index)
Given a row index between 0 and right table row count, this will return a row index into the right table's row domain.
-
getRowCount
public int getRowCount()
Description copied from class:TableReturns the number of rows stored in the table.- Specified by:
getRowCountin interfaceTableDataSource- Specified by:
getRowCountin classTable
-
resolveRowForTableAt
protected int resolveRowForTableAt(int row_number, int table_num)Description copied from class:JoinedTableGiven a row and a table index (to a parent reference table), this will return the row index in the given parent table for the given row.- Specified by:
resolveRowForTableAtin classJoinedTable
-
resolveAllRowsForTableAt
protected void resolveAllRowsForTableAt(IntegerVector row_set, int table_num)
Description copied from class:JoinedTableGiven an IntegerVector that represents a list of pointers to rows in this table, this resolves the rows to row indexes in the given parent table. This method changes the 'row_set' IntegerVector object.- Specified by:
resolveAllRowsForTableAtin classJoinedTable
-
-