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
public class S2CellIndex.RangeIterator extends java.lang.Object
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
Fields Modifier and Type Field Description private S2CellIndex.RangeNode
node
Current node pointed to by 'offset'.private int
offset
Offset intoS2CellIndex.rangeNodes
.
-
Constructor Summary
Constructors Constructor Description RangeIterator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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()
.S2CellId
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
seek(S2CellId target)
Positions the iterator at the range containing "target".private void
seekAndLoad(int offset)
S2CellId
startId()
Returns the start of the current range of leaf S2CellIds.
-
-
-
Field Detail
-
offset
private int offset
Offset intoS2CellIndex.rangeNodes
.
-
node
private S2CellIndex.RangeNode node
Current node pointed to by 'offset'.
-
-
Method Detail
-
startId
public S2CellId startId()
-
limitId
public S2CellId 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
public void seek(S2CellId target)
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)
-
-