Class S2CellIndex.ContentsIterator
java.lang.Object
com.google.common.geometry.S2CellIndex.ContentsIterator
- Enclosing class:
S2CellIndex
An iterator that visits the (cellId, label) pairs that cover a set of leaf cell ranges (see
RangeIterator). To use it, construct an instance or
clear() an existing instance, and
startUnion(S2CellIndex.RangeIterator) to visit the contents of each desired leaf cell range.
Note that when multiple leaf cell ranges are visited, this class only guarantees that each
result will be reported at least once, i.e. duplicate values may be suppressed. If you want
duplicate values to be reported again, be sure to call clear() first.
In particular, the implementation guarantees that when multiple leaf cell ranges are visited in monotonically increasing order, then each (cellId, label) pair is reported exactly once.
-
Method Summary
Modifier and TypeMethodDescriptioncellId()Returns the S2CellId of the current (cellId, label) pair.voidclear()Clears all state with respect to which range(s) have been visited.booleandone()Returns true if all (cellId, label) pairs have been visited.intlabel()Returns the label of the current (cellId, label) pair.voidnext()Advances the iterator to the next (cellId, label) pair covered by the current leaf cell range.voidPositions the ContentsIterator at the first (cellId, label) pair that covers the given leaf cell range.
-
Method Details
-
clear
public void clear()Clears all state with respect to which range(s) have been visited. -
startUnion
Positions the ContentsIterator at the first (cellId, label) pair that covers the given leaf cell range. Note that when multiple leaf cell ranges are visited using the same ContentsIterator, duplicate values may be suppressed. If you don't want this behavior, call clear() first. -
cellId
Returns the S2CellId of the current (cellId, label) pair. -
label
public int label()Returns the label of the current (cellId, label) pair. -
done
public boolean done()Returns true if all (cellId, label) pairs have been visited. -
next
public void next()Advances the iterator to the next (cellId, label) pair covered by the current leaf cell range.
-