Class 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).
    • 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 if done().
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RangeIterator

        public RangeIterator()
    • Method Detail

      • 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)