Class SelectableScheme
- Direct Known Subclasses:
BlindSearch
,CollatedBaseSearch
A given element in the set is specified through a 'row' integer whose contents can be obtained through the 'table.getCellContents(column, row)'. Every scheme is given a table and column number that the set refers to. While a given set element is refered to as a 'row', the integer is really only a pointer into the set list which can be de-referenced with a call to table.getCellContents(row). Better performance schemes will keep such calls to a minimum.
A scheme may choose to retain knowledge about a given element when it is added or removed from the set, such as a BinaryTree that catalogs all elements with respect to each other.
- Author:
- Tobias Downer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final BlockIntegerList
Some statics.protected static final BlockIntegerList
-
Constructor Summary
ConstructorsConstructorDescriptionSelectableScheme
(TableDataSource table, int column) The constructor for all schemes. -
Method Summary
Modifier and TypeMethodDescriptionabstract SelectableScheme
copy
(TableDataSource table, boolean immutable) Returns an exact copy of this scheme including any optimization information.protected final DebugLogger
Debug()
Returns the DebugLogger object to log debug messages to.abstract void
dispose()
Dispose and invalidate this scheme.protected final TObject
getCellContents
(int row) Obtains the given cell in the row from the table.protected final int
Returns the column this scheme is indexing in the table.getSubsetScheme
(Table subset_table, int subset_column) Asks the Scheme for a SelectableScheme abject that describes a sub-set of the set handled by this Scheme.protected final TransactionSystem
Returns the global transaction system.protected final TableDataSource
getTable()
Returns the Table.internalOrderIndexSet
(IntegerVector row_set) Returns a BlockIntegerList that represents the given row_set sorted in the order of this scheme.final boolean
Returns true if this scheme is immutable.abstract void
readFrom
(InputStream in) Reads the entire contents of the scheme from a InputStream object.These are the select operations that are the main purpose of the scheme.Selects all values in the column that are not null.selectBetween
(TObject ob1, TObject ob2) selectEqual
(TObject ob) selectGreater
(TObject ob) selectLess
(TObject ob) final void
Sets this scheme to immutable.toString()
Diagnostic information.abstract void
writeTo
(OutputStream out) Writes the entire contents of the scheme to an OutputStream object.
-
Field Details
-
EMPTY_LIST
Some statics. -
ONE_LIST
-
-
Constructor Details
-
SelectableScheme
The constructor for all schemes.
-
-
Method Details
-
getTable
Returns the Table. -
getSystem
Returns the global transaction system. -
Debug
Returns the DebugLogger object to log debug messages to. -
getColumn
protected final int getColumn()Returns the column this scheme is indexing in the table. -
getCellContents
Obtains the given cell in the row from the table. -
setImmutable
public final void setImmutable()Sets this scheme to immutable. -
isImmutable
public final boolean isImmutable()Returns true if this scheme is immutable. -
toString
Diagnostic information. -
writeTo
Writes the entire contents of the scheme to an OutputStream object.- Throws:
IOException
-
readFrom
Reads the entire contents of the scheme from a InputStream object. If the scheme is full of any information it throws an exception.- Throws:
IOException
-
copy
Returns an exact copy of this scheme including any optimization information. The copied scheme is identical to the original but does not share any parts. Modifying any part of the copied scheme will have no effect on the original and vice versa.The newly copied scheme can be given a new table source. If 'immutable' is true, then the resultant scheme is an immutable version of the parent. An immutable version may share information with the copied version so can not be changed.
NOTE: Even if the scheme maintains no state you should still be careful to ensure a fresh SelectableScheme object is returned here.
-
dispose
public abstract void dispose()Dispose and invalidate this scheme. -
internalOrderIndexSet
Returns a BlockIntegerList that represents the given row_set sorted in the order of this scheme. The values in 'row_set' must be references to rows in the domain of the table this scheme represents.The returned set must be stable, meaning if values are equal they keep the same ordering.
Note that the default implementation of this method can often be optimized. For example, InsertSearch uses a secondary RID list to sort items if the given list is over a certain size.
-
getSubsetScheme
Asks the Scheme for a SelectableScheme abject that describes a sub-set of the set handled by this Scheme. Since a Table stores a subset of a given DataTable, we pass this as the argument. It returns a new SelectableScheme that orders the rows in the given columns order. The 'column' variable specifies the column index of this column in the given table. -
selectAll
These are the select operations that are the main purpose of the scheme. They retrieve the given information from the set. Different schemes will have varying performance on different types of data sets. The select operations must *always* return a resultant row set that is sorted from lowest to highest. -
selectFirst
-
selectNotFirst
-
selectLast
-
selectNotLast
-
selectAllNonNull
Selects all values in the column that are not null. -
selectEqual
-
selectNotEqual
-
selectGreater
-
selectLess
-
selectGreaterOrEqual
-
selectLessOrEqual
-
selectBetween
-