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 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
    Current node pointed to by 'offset'.
    private int
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    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
    Positions this iterator at the first range of leaf cells (if any).
    boolean
    Returns true if the iterator is positioned beyond the last valid range.
    void
    Positions the iterator so that done() is true.
    boolean
    Returns true if no (s2cell_id, label) pairs intersect this range, or if done().
    The (non-inclusive) end of the current range of leaf S2CellIds.
    void
    Advances the iterator to the next range of leaf cells.
    boolean
    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)
     
    Returns the start of the current range of leaf S2CellIds.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • RangeIterator

      public RangeIterator()
  • Method Details

    • startId

      public S2CellId startId()
      Returns the start of the current range of leaf S2CellIds. When done(), this returns the end of the max level of cells, so that most loops may test this method instead of done().
    • 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 if done().
    • 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)