|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- the type of objects that this Search
searches forpublic interface Search<T>
This interface represents an initialized search on an index.
It allows to browse the data of an index - use next()
and previous()
methods to gather the next or previous object of this search. If true
is returned, the next/previous found object can be retrieved by
getCurrentObject()
.
Index
Method Summary | |
---|---|
Search<T> |
clone()
Creates and returns a copy of this search. |
void |
close()
Closes this search indicating that no objects will be retrieved. |
T |
getCurrentObject()
Returns the object found by the last search. |
boolean |
next()
Searches for the next object (forward search) and returns false if none is found. |
boolean |
previous()
Searches for the previous object (backward search) and returns false if none is found. |
boolean |
skip(int count)
Skips count objects using next() or previous()
search and returns false if count objects cannot be skipped. |
Method Detail |
---|
T getCurrentObject() throws java.lang.IllegalStateException
next()
or previous()
has returned true, this method returns the matching
object. If false has been returned, this method throws an IllegalStateException
.
java.lang.IllegalStateException
- if there is no current object (next/previous method was not called or returned false)boolean next() throws java.lang.IllegalStateException
getCurrentObject()
.
java.lang.IllegalStateException
- if there was a problem retrieving the next object from the underlying storageboolean previous() throws java.lang.IllegalStateException
getCurrentObject()
.
java.lang.IllegalStateException
- if there was a problem retrieving the next object from the underlying storageboolean skip(int count) throws java.lang.IllegalStateException
count
objects using next()
or previous()
search and returns false if count
objects cannot be skipped.
Otherwise, the found object can be retrieved by getCurrentObject()
.
Note that this is equivalent to calling next()
or previous()
while true is returned up to count
times. So if the
method returns false, the getCurrentObject()
may not return
a valid object.
count
- number of objects to skip,
i.e. the number of calls to next()
if count is positive
or previous()
if count is negative
count
objects has been skipped
java.lang.IllegalStateException
- if there was a problem retrieving the next/previous object from the underlying storageSearch<T> clone() throws java.lang.CloneNotSupportedException
next()
or previous()
will return the same values as for the original search.
In practice, the clonned search is often used to do the search in both directions from the same starting point.
java.lang.CloneNotSupportedException
- if this search cannot be clonedvoid close()
next()
, previous()
, etc.) should not be called.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |