|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mckoi.database.SelectableScheme
com.mckoi.database.CollatedBaseSearch
com.mckoi.database.InsertSearch
public final class InsertSearch
This is a SelectableScheme similar in some ways to the binary tree. When a new row is added, it is inserted into a sorted list of rows. We can then use this list to select out the sorted list of elements.
This requires less memory than the BinaryTree, however it is not as fast. Even though, it should still perform fairly well on medium size data sets. On large size data sets, insert and remove performance may suffer.
This object retains knowledge of all set elements unlike BlindSearch which has no memory overhead.
Performance should be very comparable to BinaryTree for sets that aren't altered much.
Field Summary |
---|
Fields inherited from class com.mckoi.database.SelectableScheme |
---|
EMPTY_LIST, ONE_LIST |
Constructor Summary | |
---|---|
InsertSearch(TableDataSource table,
int column)
The Constructor. |
|
InsertSearch(TableDataSource table,
int column,
IntegerVector vec)
Constructor sets the scheme with a pre-sorted list. |
Method Summary | |
---|---|
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. |
SelectableScheme |
copy(TableDataSource table,
boolean immutable)
Returns an exact copy of this scheme including any optimization information. |
void |
dispose()
Disposes this scheme. |
protected TObject |
firstInCollationOrder()
Returns the first value of this column (in collated order). |
void |
insert(int row)
Inserts a row into the list. |
protected TObject |
lastInCollationOrder()
Returns the last value of this column (in collated order). |
void |
readFrom(java.io.InputStream in)
Reads the entire state of the scheme from the input stream. |
void |
remove(int row)
Removes a row from the list. |
protected int |
searchFirst(TObject val)
Finds the position in the collated set of the first value in the column equal to the given value. |
protected 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()
The select operations for this scheme. |
protected int |
setSize()
The size of the set (the number of rows in this column). |
void |
writeTo(java.io.OutputStream out)
Writes the entire state of the scheme to the output stream. |
Methods inherited from class com.mckoi.database.CollatedBaseSearch |
---|
selectRange, selectRange |
Methods inherited from class com.mckoi.database.SelectableScheme |
---|
Debug, getCellContents, getColumn, getSubsetScheme, getSystem, getTable, internalOrderIndexSet, isImmutable, selectAllNonNull, selectBetween, selectEqual, selectFirst, selectGreater, selectGreaterOrEqual, selectLast, selectLess, selectLessOrEqual, selectNotEqual, selectNotFirst, selectNotLast, setImmutable, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public InsertSearch(TableDataSource table, int column)
public InsertSearch(TableDataSource table, int column, IntegerVector vec)
Method Detail |
---|
public void insert(int row)
insert
in class CollatedBaseSearch
public void remove(int row)
remove
in class CollatedBaseSearch
public void readFrom(java.io.InputStream in) throws java.io.IOException
readFrom
in class CollatedBaseSearch
java.io.IOException
public void writeTo(java.io.OutputStream out) throws java.io.IOException
writeTo
in class CollatedBaseSearch
java.io.IOException
public SelectableScheme copy(TableDataSource table, boolean immutable)
copy
in class SelectableScheme
public void dispose()
dispose
in class CollatedBaseSearch
protected int searchFirst(TObject val)
CollatedBaseSearch
searchFirst
in class CollatedBaseSearch
protected int searchLast(TObject val)
CollatedBaseSearch
searchLast
in class CollatedBaseSearch
protected int setSize()
CollatedBaseSearch
setSize
in class CollatedBaseSearch
protected TObject firstInCollationOrder()
CollatedBaseSearch
firstInCollationOrder
in class CollatedBaseSearch
protected TObject lastInCollationOrder()
CollatedBaseSearch
lastInCollationOrder
in class CollatedBaseSearch
protected IntegerVector addRangeToSet(int start, int end, IntegerVector ivec)
CollatedBaseSearch
addRangeToSet
in class CollatedBaseSearch
public IntegerVector selectAll()
selectAll
in class CollatedBaseSearch
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |