public abstract class RangeIterator<K extends java.lang.Comparable<K>,T extends CombinedValue<K>> extends AbstractIterator<T> implements java.io.Closeable
Modifier and Type | Class and Description |
---|---|
static class |
RangeIterator.Builder<K extends java.lang.Comparable<K>,D extends CombinedValue<K>> |
AbstractIterator.State
next, state
Modifier | Constructor and Description |
---|---|
|
RangeIterator(K min,
K max,
long count) |
protected |
RangeIterator(RangeIterator.Builder.Statistics<K,T> statistics) |
|
RangeIterator(RangeIterator<K,T> range) |
Modifier and Type | Method and Description |
---|---|
long |
getCount() |
K |
getCurrent() |
K |
getMaximum() |
K |
getMinimum() |
protected static <K extends java.lang.Comparable<K>,D extends CombinedValue<K>> |
isOverlapping(K min,
K max,
RangeIterator<K,D> b)
Ranges are overlapping the following cases:
* When they have a common subrange:
min b.current max b.max
+---------|--------------+------------|
b.current min max b.max
|--------------+---------+------------|
min b.current b.max max
+----------|-------------|------------+
If either range is empty, they're disjoint.
|
protected static <K extends java.lang.Comparable<K>,D extends CombinedValue<K>> |
isOverlapping(RangeIterator<K,D> a,
RangeIterator<K,D> b) |
protected abstract void |
performSkipTo(K nextToken) |
protected T |
recomputeNext() |
T |
skipTo(K nextToken)
When called, this iterators current position should
be skipped forwards until finding either:
1) an element equal to or bigger than next
2) the end of the iterator
|
protected boolean |
tryToComputeNext() |
computeNext, endOfData, hasNext, next, peek, remove
protected RangeIterator(RangeIterator.Builder.Statistics<K,T> statistics)
public RangeIterator(RangeIterator<K,T> range)
public final K getMinimum()
public final K getCurrent()
public final K getMaximum()
public final long getCount()
public final T skipTo(K nextToken)
nextToken
- value to skip the iterator forward until matchingprotected abstract void performSkipTo(K nextToken)
protected T recomputeNext()
protected boolean tryToComputeNext()
tryToComputeNext
in class AbstractIterator<T extends CombinedValue<K>>
protected static <K extends java.lang.Comparable<K>,D extends CombinedValue<K>> boolean isOverlapping(RangeIterator<K,D> a, RangeIterator<K,D> b)
protected static <K extends java.lang.Comparable<K>,D extends CombinedValue<K>> boolean isOverlapping(K min, K max, RangeIterator<K,D> b)
Copyright © 2009-2021 The Apache Software Foundation