Package com.google.common.geometry
Class S2CellIndex.RangeIterator
java.lang.Object
com.google.common.geometry.S2CellIndex.RangeIterator
- Direct Known Subclasses:
S2CellIndex.NonEmptyRangeIterator
- Enclosing class:
S2CellIndex
An iterator that seeks and iterates over a set of non-overlapping leaf cell ranges that cover
the entire sphere. The indexed (s2cell_id, label) pairs that intersect the current leaf cell
range can be visited using ContentsIterator (see below).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate S2CellIndex.RangeNode
Current node pointed to by 'offset'.private int
Offset intoS2CellIndex.rangeNodes
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
advance
(int n) Advances this iterator 'n' times and returns true, or if doing so would advance this iterator past the end, leaves the iterator unmodified and returns false.void
begin()
Positions this iterator at the first range of leaf cells (if any).boolean
done()
Returns true if the iterator is positioned beyond the last valid range.void
finish()
Positions the iterator so that done() is true.boolean
isEmpty()
Returns true if no (s2cell_id, label) pairs intersect this range, or ifdone()
.limitId()
The (non-inclusive) end of the current range of leaf S2CellIds.void
next()
Advances the iterator to the next range of leaf cells.boolean
prev()
Returns false if the iterator was already positioned at the beginning, otherwise positions the iterator at the previous entry and returns true.void
Positions the iterator at the range containing "target".private void
seekAndLoad
(int offset) startId()
Returns the start of the current range of leaf S2CellIds.
-
Field Details
-
offset
private int offsetOffset intoS2CellIndex.rangeNodes
. -
node
Current node pointed to by 'offset'.
-
-
Constructor Details
-
RangeIterator
public RangeIterator()
-
-
Method Details
-
startId
-
limitId
The (non-inclusive) end of the current range of leaf S2CellIds. -
done
public boolean done()Returns true if the iterator is positioned beyond the last valid range. -
begin
public void begin()Positions this iterator at the first range of leaf cells (if any). -
finish
public void finish()Positions the iterator so that done() is true. -
next
public void next()Advances the iterator to the next range of leaf cells. -
prev
public boolean prev()Returns false if the iterator was already positioned at the beginning, otherwise positions the iterator at the previous entry and returns true. -
seek
Positions the iterator at the range containing "target". Such a range exists as long as the target is a valid leaf cell.- Parameters:
target
- a valid leaf (level 30) cell to seek to
-
isEmpty
public boolean isEmpty()Returns true if no (s2cell_id, label) pairs intersect this range, or ifdone()
. -
advance
public boolean advance(int n) Advances this iterator 'n' times and returns true, or if doing so would advance this iterator past the end, leaves the iterator unmodified and returns false. -
seekAndLoad
private void seekAndLoad(int offset)
-