Class RspRangeIterator
java.lang.Object
io.deephaven.engine.rowset.impl.rsp.RspRangeIterator
- All Implemented Interfaces:
LongRangeIterator
,SafeCloseable
,AutoCloseable
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
advance
(long key) Advance the current iterator position while the current range end is less than key.void
close()
long
end()
boolean
boolean
hasNext()
This method should be called: * After the iterator is created and before calling any other methods; it returns false, calling any other methods results in undefined behavior.void
next()
void
postpone
(long v) At call, start() <= v <= end()rangeIteratorView
(long startOffset, long rangesEnd) Create a RangeIterator that is a view into this iterator; the returned rangeIterator has current start() - startOffset as it initial start value (note the iterator needs to have a valid current position at the time of the call).void
search
(RowSetUtils.Comparator comp) Advance the current iterator (start) position to the rightmost (last) value v that maintains comp.directionToTargetFrom(v) >= 0.long
start()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.deephaven.util.datastructures.LongRangeIterator
forAllLongRanges
-
Constructor Details
-
RspRangeIterator
-
-
Method Details
-
start
public long start()- Specified by:
start
in interfaceLongRangeIterator
- Returns:
- start point of the current interval.
-
end
public long end()- Specified by:
end
in interfaceLongRangeIterator
- Returns:
- end point of the current interval, inclusive.
-
postpone
public void postpone(long v) At call, start() <= v <= end()- Parameters:
v
- Next call to start will return this value.
-
hasNext
public boolean hasNext()This method should be called: * After the iterator is created and before calling any other methods; it returns false, calling any other methods results in undefined behavior. * Right after a call to next, similar to above.- Specified by:
hasNext
in interfaceLongRangeIterator
- Returns:
- true if a call to next leads to a valid range to be read from start() and end().
-
next
public void next()- Specified by:
next
in interfaceLongRangeIterator
-
forEachLongRange
- Specified by:
forEachLongRange
in interfaceLongRangeIterator
-
advance
public boolean advance(long key) Advance the current iterator position while the current range end is less than key. This results in either (a) true, leaving a current range whose start value is greater or equal than key, or (b) false, leaving an exhausted, invalid iterator. Note if the iterator is not exhausted, true is returned and the satisfying range is left as the iterator's current range: no need to call next to get to it. Also note the iterator may not move if at call entry the current range already satisfies (a). If this method returns false, it implies the iterator has been exhausted, the current range is invalid, and subsequent calls to hasNext will return false; there is no guarantee as to where the start and end positions are left in this case.- Parameters:
key
- a key to search forward from the current iterator position- Returns:
- true if case (a), false if case (b).
-
search
Advance the current iterator (start) position to the rightmost (last) value v that maintains comp.directionToTargetFrom(v) >= 0. I.e, either hasNext() returns false after this call, or the next value in the iterator nv would be such that comp.directionToTargetFrom(nv) < 0. Note this method should be called only after calling hasNext() and next() at least once, eg, from a valid current position in a non-empty and also non-exhausted iterator.- Parameters:
comp
- a comparator used to search forward from the current iterator position
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceSafeCloseable
-
rangeIteratorView
Create a RangeIterator that is a view into this iterator; the returned rangeIterator has current start() - startOffset as it initial start value (note the iterator needs to have a valid current position at the time of the call). The returned RangeIterator includes all the ranges until the end parameter (exclusive), and as it advances it will make the underlying iterator advance. Once the RangeIterator is exhausted, the underlying iterator will have a current value that is one after the last range returned by the range iterator (not this may have been truncated to a partial, still valid, range).- Parameters:
startOffset
- The resulting range iterator returns ranges offset with this value.rangesEnd
- boundary (exclusive) on the underlying iterator ranges for the ranges returned.- Returns:
-