Interface RspArray.SpanCursor
- All Known Subinterfaces:
RspArray.SpanCursorForward
public static interface RspArray.SpanCursor
-
Method Summary
Modifier and TypeMethodDescriptionboolean
advance
(long key) Advances the pointer forward to the next span in the sequence whose interval could have it include the key argument.arr()
int
arrIdx()
boolean
hasNext()
This method should be called: * After the pointer is created and before calling any other methods; if it returns false, calling any other methods results in undefined behavior.void
next()
Advances the pointer to the next span in the linear sequence.void
release()
Releases the RspArray reference.span()
long
spanInfo()
default long
spanKey()
-
Method Details
-
spanKey
default long spanKey()- Returns:
- the current span's first key if the current span is valid, undefined otherwise.
-
spanInfo
long spanInfo()- Returns:
- the current span's span info if the current span is valid, undefined otherwise.
-
span
Object span()- Returns:
- the current span if valid, undefined otherwise.
-
next
void next()Advances the pointer to the next span in the linear sequence. If the span before the call was the last one, a subsequent call to hasNext will return false. -
hasNext
boolean hasNext()This method should be called: * After the pointer is created and before calling any other methods; if it returns false, calling any other methods results in undefined behavior. * Right after a call to any advance method, similar to above.- Returns:
- true if the pointer currently points to a valid span.
-
advance
boolean advance(long key) Advances the pointer forward to the next span in the sequence whose interval could have it include the key argument. More specifically, the current span position is effectively advanced forward as long as the provided key is bigger than the right endpoint for the current span. This operation is O(log(cardinality)). Note this may not move the pointer if the current span already satisfies the constraint, or it may invalidate the pointer if the key is to the right of the last valid span. Note also advance should only be called on a non-empty cursor, after having called hasNext() and next() at least once.- Parameters:
key
- key to search forward from the current span position.- Returns:
- false if the cursor is exhausted and there was no span satisfying the restriction found, true otherwise.
-
release
void release()Releases the RspArray reference. -
arr
RspArray arr() -
arrIdx
int arrIdx()
-