Package com.mckoi.database
Class BlindSearch
java.lang.Object
com.mckoi.database.SelectableScheme
com.mckoi.database.BlindSearch
This is a scheme that performs a blind search of a given set. It records
no information about how a set element relates to the rest. It blindly
searches through the set to find elements that match the given criteria.
This scheme performs badly on large sets because it requires that the database is queried often for information. However since it records no information about the set, memory requirements are non-existant.
This scheme should not be used for anything other than small domain sets because the performance suffers very badly with larger sets. It is ideal for small domain sets because of its no memory overhead. For any select operation this algorithm must check every element in the set.
- Author:
- Tobias Downer
-
Field Summary
Fields inherited from class com.mckoi.database.SelectableScheme
EMPTY_LIST, ONE_LIST
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy
(TableDataSource table, boolean immutable) Returns an exact copy of this scheme including any optimization information.void
dispose()
Disposes and invalidates the BlindSearch.void
insert
(int row) This scheme doesn't take any notice of insertions or removals.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.These are the select operations that are the main purpose of the scheme.selectRange
(SelectableRange range) selectRange
(SelectableRange[] ranges) void
writeTo
(OutputStream out) Writes the entire state of the scheme to the output stream.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
-
Constructor Details
-
BlindSearch
The Constructor.
-
-
Method Details
-
insert
public void insert(int row) This scheme doesn't take any notice of insertions or removals. -
remove
public void remove(int row) This scheme doesn't take any notice of insertions or removals. -
readFrom
Reads the entire state of the scheme from the input stream. This is a trivial case for BlindSearch which doesn't require any data to be stored.- Specified by:
readFrom
in classSelectableScheme
- Throws:
IOException
-
writeTo
Writes the entire state of the scheme to the output stream. This is a trivial case for BlindSearch which doesn't require any data to be stored.- Specified by:
writeTo
in classSelectableScheme
- 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.- Specified by:
copy
in classSelectableScheme
-
dispose
public void dispose()Disposes and invalidates the BlindSearch.- Specified by:
dispose
in classSelectableScheme
-
selectAll
Description copied from class:SelectableScheme
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.- Overrides:
selectAll
in classSelectableScheme
-
selectRange
-
selectRange
-