public abstract class CollatedBaseSearch extends SelectableScheme
The default implementation maintains no state,
Derived classes are required to implement 'copy', 'searchFirst' and 'searchLast' methods. With these basic methods, a selectable scheme can be generated provided the column is sorted in ascending order (value of row i is <= value of row i+1). Overwrite 'firstInCollationOrder', 'lastInCollationOrder' and 'addRangeToSet' methods for non sorted underlying sets.
Assumptions - the underlying column is sorted low to high (value of row i is <= value of row i+1).
EMPTY_LIST, ONE_LIST
Constructor and Description |
---|
CollatedBaseSearch(TableDataSource table,
int column)
The Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected IntegerVector |
addRangeToSet(int start,
int end,
IntegerVector ivec)
Adds the set indexes to the list that represent the range of values
between the start (inclusive) and end offset (inclusive) given.
|
void |
dispose()
Disposes and invalidates the BlindSearch.
|
protected TObject |
firstInCollationOrder()
Returns the first value of this column (in collated order).
|
void |
insert(int row)
This scheme doesn't take any notice of insertions or removals.
|
protected TObject |
lastInCollationOrder()
Returns the last value of this column (in collated order).
|
void |
readFrom(InputStream in)
Reads the entire state of the scheme from the input stream.
|
void |
remove(int row)
This scheme doesn't take any notice of insertions or removals.
|
protected abstract int |
searchFirst(TObject val)
Finds the position in the collated set of the first value in the column
equal to the given value.
|
protected abstract int |
searchLast(TObject val)
Finds the position in the collated set of the last value in the column
equal to the given value.
|
IntegerVector |
selectAll()
These are the select operations that are the main purpose of the scheme.
|
IntegerVector |
selectRange(SelectableRange range)
Selects the given range of values from this index.
|
IntegerVector |
selectRange(SelectableRange[] ranges)
Selects a set of ranges from this index.
|
protected int |
setSize()
The size of the set (the number of rows in this column).
|
void |
writeTo(OutputStream out)
Writes the entire state of the scheme to the output stream.
|
copy, Debug, getCellContents, getColumn, getSubsetScheme, getSystem, getTable, internalOrderIndexSet, isImmutable, selectAllNonNull, selectBetween, selectEqual, selectFirst, selectGreater, selectGreaterOrEqual, selectLast, selectLess, selectLessOrEqual, selectNotEqual, selectNotFirst, selectNotLast, setImmutable, toString
public CollatedBaseSearch(TableDataSource table, int column)
public void insert(int row)
public void remove(int row)
public void readFrom(InputStream in) throws IOException
readFrom
in class SelectableScheme
IOException
public void writeTo(OutputStream out) throws IOException
writeTo
in class SelectableScheme
IOException
public void dispose()
dispose
in class SelectableScheme
protected abstract int searchFirst(TObject val)
protected abstract int searchLast(TObject val)
protected int setSize()
protected TObject firstInCollationOrder()
protected TObject lastInCollationOrder()
protected IntegerVector addRangeToSet(int start, int end, IntegerVector ivec)
public IntegerVector selectAll()
SelectableScheme
selectAll
in class SelectableScheme
public IntegerVector selectRange(SelectableRange range)
SelectableScheme
This must guarentee that the returned set is sorted from lowest to highest value.
public IntegerVector selectRange(SelectableRange[] ranges)
SelectableScheme
If the above rules are enforced (as they must be) then this method will return a set that is sorted from lowest to highest value.
This must guarentee that the returned set is sorted from lowest to highest value.
Copyright © 2015. All rights reserved.