public interface RangeIterator
RangeIterator rit = ...; rit.bottomUpInit(); while (rit.hasNext()) { int from = rit.min(); int to = rit.max(); // operate on range [from,to] here rit.next(); }OR
DisposableRangeIterator rit = ...; rit.topDownInit(); while (rit.hasPrevious()) { int from = rit.min(); int to = rit.max(); // operate on range [from,to] here rit.previous(); }
Modifier and Type | Method and Description |
---|---|
void |
bottomUpInit() |
boolean |
hasNext()
Returns true if the iteration has more ranges.
|
boolean |
hasPrevious()
Returns true if the iteration has more ranges.
|
int |
max()
Return the upper bound of the current range (inclusive)
|
int |
min()
Return the lower bound of the current range (inclusive)
|
void |
next()
Compute the next range.
|
void |
previous()
Compute the previous range.
|
void |
topDownInit() |
void bottomUpInit()
void topDownInit()
boolean hasNext()
boolean hasPrevious()
void next()
void previous()
int min()
int max()
Copyright © 2015. All rights reserved.