public class Reverserator<E> extends Object implements ITupleCursor<E>
ITupleCursor and
operations on the iterator effect the state of the cursor and visa versa.
Note: This implements the full ITupleCursor API so that we can stack
filters over this class as readily as over an ITupleCursor. However,
the semantics of hasNext() and next() and of
hasPrior() and prior() are of course reversed (the move
counter to the natural index order).
| Constructor and Description |
|---|
Reverserator(ITupleCursor<E> src) |
| Modifier and Type | Method and Description |
|---|---|
IIndex |
getIndex()
The backing index being traversed by the
ITupleCursor. |
boolean |
hasNext()
Return
true if there is another tuple that orders after
the current cursor position in the natural order of the index and that
lies within the optional constraints key-range on the cursor or on the
index partition. |
boolean |
hasPrior()
Return
true if there is another tuple that orders before
the current cursor position in the natural order of the index and that
lies within the optional key-range constraints on the cursor or on the
index partition. |
ITuple<E> |
next()
Position the cursor on the next tuple in the natural key order of the
index.
|
ITuple<E> |
prior()
Position the cursor on the first visitable tuple ordered less than the
current cursor position in the natural key order of the index and return
that tuple.
|
void |
remove()
Removes the tuple (if any) from the index corresponding to the current
cursor position.
|
ITuple<E> |
seek(byte[] key)
Positions the cursor on the specified key.
|
ITuple<E> |
seek(Object key)
Variant that first encodes the key using the object returned by
IndexMetadata.getTupleSerializer() for the backing index. |
public Reverserator(ITupleCursor<E> src)
public ITuple<E> next()
ITupleCursor
Note: in order to maintain standard iterator semantics, this method will
visit the #first() visitable tuple if the current cursor position
is undefined.
public boolean hasNext()
ITupleCursortrue if there is another tuple that orders after
the current cursor position in the natural order of the index and that
lies within the optional constraints key-range on the cursor or on the
index partition.
Note: in order to maintain standard iterator semantics, this method will
return true if the current cursor position is undefined
and #first() would report the existence of a visitable tuple.
public void remove()
ITupleCursorITupleCursor2.tuple() will return
null to indicate that there is no tuple in the index
corresponding to the deleted tuple. (When delete markers are enabled and
deleted tuples are being visited, then ITupleCursor2.tuple() will
return the new state of the tuple with its delete marker set.)public IIndex getIndex()
ITupleCursorITupleCursor.getIndex in interface ITupleCursor<E>public boolean hasPrior()
ITupleCursortrue if there is another tuple that orders before
the current cursor position in the natural order of the index and that
lies within the optional key-range constraints on the cursor or on the
index partition.
Note: in order to maintain semantics parallel to standard iterator
semantics, this method will return true if the current
cursor position is undefined and #last() would report the
existence of a visitable tuple.
hasPrior in interface ITupleCursor<E>public ITuple<E> prior()
ITupleCursor
Note: in order to maintain semantics parallel to standard iterator
semantics, this method will visit the #last() visitable tuple if
the current cursor position is undefined.
prior in interface ITupleCursor<E>public ITuple<E> seek(byte[] key)
ITupleCursorIf there is a corresponding visitable tuple in the index then it is returned.
If there is no visitable tuple in the index for that key then
null is returned. You can use ITupleCursor.prior() or
ITupleCursor.next() to locate the first visitable tuple to either side of the
cursor position.
The cursor position is updated to the specified key regardless of whether there is a visitable tuple in the index for that key.
seek in interface ITupleCursor<E>key - The key (required).null otherwise.public ITuple<E> seek(Object key)
ITupleCursorIndexMetadata.getTupleSerializer() for the backing index.seek in interface ITupleCursor<E>key - The key (required).null otherwise.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.