Interface RangeIterator
- All Known Subinterfaces:
SearchRangeIterator
- All Known Implementing Classes:
IndexRangeIteratorView,RangeIterator.ArrayBacked,RangeIterator.Single,RspRangeIterator.RangeIteratorView,SingletonContainer.SearchRangeIter
public interface RangeIterator
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classstatic class -
Method Summary
Modifier and TypeMethodDescriptionintend()End of the current range (exclusive).default booleanCall accept on the provided AbortableRangeConsumer until it returns false or we run out of values.booleanhasNext()Checks if the iterator has more ranges.voidnext()Advance the iterator to the next range.default intnext(short[] buffer, int offset, int maxRanges) Get the next batch of ranges.intstart()Start of the current range.
-
Method Details
-
hasNext
boolean hasNext()Checks if the iterator has more ranges. If hasNext() returns false, calling next thereafter results in undefined behavior.- Returns:
- whether there is another range.
-
start
int start()Start of the current range.Calling start() without calling next() at least once results in undefined behavior.
- Returns:
- the start of the current range.
-
end
int end()End of the current range (exclusive).Calling end() without calling next() at least once results in undefined behavior.
- Returns:
- the end of the current range (exclusive).
-
next
void next()Advance the iterator to the next range. Only call after hasNext() has returned true. -
forEachRange
Call accept on the provided AbortableRangeConsumer until it returns false or we run out of values.- Parameters:
rc- An AbortableRangeConsumer to feed ranges to.- Returns:
- false if AbortableRangeConsumer returned false at any point, true otherwise.
-
next
default int next(short[] buffer, int offset, int maxRanges) Get the next batch of ranges.- Parameters:
buffer- a short array where consecutive pairs of (start, end-1) values will be stored.offset- where in buffer to start storing range boundary values.maxRanges- maximum number of ranges that can be written to buffer;buffershould have at least space for2*maxRangesshorts starting atoffset.- Returns:
- how many ranges were written in
buffer; this is two times the individual elements written.
-