public abstract class IndexResultSet<T> extends java.lang.Object implements HGRandomAccessResult<T>, CountMe
An IndexResultSet
is based on a cursor over an indexed set of values. Implementation of
complex query execution may move the cursor position based on some index key to speed up query processing.
HGRandomAccessResult.GotoResult
Modifier and Type | Field and Description |
---|---|
protected ByteArrayConverter<T> |
converter |
protected java.lang.Object |
current |
protected BJETxCursor |
cursor |
protected DatabaseEntry |
data |
protected DatabaseEntry |
key |
protected int |
lookahead |
protected java.lang.Object |
next |
protected java.lang.Object |
prev |
EMPTY
Modifier | Constructor and Description |
---|---|
protected |
IndexResultSet()
Construct an empty result set.
|
|
IndexResultSet(BJETxCursor cursor,
DatabaseEntry keyIn,
ByteArrayConverter<T> converter)
Construct a result set matching a specific key.
|
Modifier and Type | Method and Description |
---|---|
protected abstract T |
advance() |
protected void |
assignData(DatabaseEntry entry,
byte[] data)
Copy
data into the entry . |
protected abstract T |
back() |
protected void |
checkCursor() |
void |
close()
Free all system resources held up by the result set and invalidate
it for further use.
|
protected void |
closeNoException() |
int |
count() |
T |
current()
Returns the current element in the result set.
|
protected void |
finalize() |
void |
goAfterLast()
Move the cursor of this result set after the last result.
|
void |
goBeforeFirst()
Move the cursor of this result set before the first result.
|
HGRandomAccessResult.GotoResult |
goTo(T value,
boolean exactMatch)
Position the result set at a particular value if that value
is indeed part of the result set.
|
boolean |
hasNext() |
boolean |
hasPrev()
Return
true if there is a previous element in the current
iteration state and false otherwise. |
protected void |
moveNext() |
protected void |
movePrev() |
T |
next() |
protected void |
positionToCurrent(byte[] data,
int offset,
int length) |
T |
prev()
Returns the previous element in this iteration.
|
void |
remove() |
void |
removeCurrent()
Remove current element.
|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isOrdered
protected BJETxCursor cursor
protected java.lang.Object current
protected java.lang.Object prev
protected java.lang.Object next
protected DatabaseEntry key
protected DatabaseEntry data
protected ByteArrayConverter<T> converter
protected int lookahead
protected IndexResultSet()
Construct an empty result set.
public IndexResultSet(BJETxCursor cursor, DatabaseEntry keyIn, ByteArrayConverter<T> converter)
Construct a result set matching a specific key.
cursor
- key
- protected final void closeNoException()
protected final void checkCursor()
protected void assignData(DatabaseEntry entry, byte[] data)
Copy data
into the entry
. Adjust entry
's byte buffer if needed.
entry
- data
- protected final void moveNext()
protected final void movePrev()
protected abstract T advance()
protected abstract T back()
protected void positionToCurrent(byte[] data, int offset, int length)
public void goBeforeFirst()
HGRandomAccessResult
Move the cursor of this result set before the first result. This is equivalent
to resetting the cursor to its initial state, right after the result set was
created. When positioned
before the first result, there is no current element, hasPrev
will
return false and hasNext
will return true if there's at least
one element in this result set.
goBeforeFirst
in interface HGRandomAccessResult<T>
public void goAfterLast()
HGRandomAccessResult
Move the cursor of this result set after the last result. When positioned
after the last result, there is no current element, hasNext
will
return false and hasPrev
will return true if there's at least
one element in this result set.
goAfterLast
in interface HGRandomAccessResult<T>
public HGRandomAccessResult.GotoResult goTo(T value, boolean exactMatch)
HGRandomAccessResult
Position the result set at a particular value if that value is indeed part of the result set.
goTo
in interface HGRandomAccessResult<T>
value
- The value where this result set should be positioned.exactMatch
- A flag indicating whether the passed in value should
match exactly a value in the result set, or whether the cursor should
be positioned to the closest value. Here "closest" means "smallest
greater than the value
parameter.GotoResult
.public final void close()
HGSearchResult
Free all system resources held up by the result set and invalidate it for further use.
close
in interface HGSearchResult<T>
close
in interface CloseMe
public final T current()
HGSearchResult
Returns the current element in the result set. If there is no current element,
java.util.NoSuchElementException
is thrown. There
is no current element if the next
method was never invoked.
current
in interface HGSearchResult<T>
HGSearchResult
.public final boolean hasPrev()
TwoWayIterator
Return true
if there is a previous element in the current
iteration state and false
otherwise. After the iterator
has been initialized, the value of hasPrev
will always be
false
.
hasPrev
in interface TwoWayIterator<T>
public final boolean hasNext()
hasNext
in interface java.util.Iterator<T>
public final T prev()
TwoWayIterator
Returns the previous element in this iteration.
prev
in interface TwoWayIterator<T>
public final void remove()
remove
in interface java.util.Iterator<T>
protected void finalize()
finalize
in class java.lang.Object
public void removeCurrent()