Class S2EdgeIndex.DataEdgeIterator

  • Enclosing class:
    S2EdgeIndex

    public static class S2EdgeIndex.DataEdgeIterator
    extends java.lang.Object
    An iterator on data edges that may cross a query edge (a,b). Create the iterator, call getCandidates(), then hasNext()/next() repeatedly.

    The current edge in the iteration has index index(), goes between from() and to().

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.util.ArrayList<java.lang.Integer> candidates
      All the candidates obtained by getCandidates() when we are using a quad-tree (i.e.
      private int currentIndex
      Index of the current edge and of the edge before the last next() call.
      private int currentIndexInCandidates
      Index within array above.
      private S2EdgeIndex edgeIndex
      The structure containing the data edges.
      private boolean isBruteForce
      Tells whether getCandidates() obtained the candidates through brute force iteration or using the quad tree structure.
      private int numEdges
      Cache of edgeIndex.getNumEdges() so that hasNext() doesn't make an extra call
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void getCandidates​(S2Point a, S2Point b)
      Initializes the iterator to iterate over a set of candidates that may cross the edge (a,b).
      boolean hasNext()
      False if there are no more candidates; true otherwise.
      int index()
      Index of the current edge in the iteration.
      void next()
      Iterate to the next available candidate.
      • Methods inherited from class java.lang.Object

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

      • edgeIndex

        private final S2EdgeIndex edgeIndex
        The structure containing the data edges.
      • isBruteForce

        private boolean isBruteForce
        Tells whether getCandidates() obtained the candidates through brute force iteration or using the quad tree structure.
      • currentIndex

        private int currentIndex
        Index of the current edge and of the edge before the last next() call.
      • numEdges

        private int numEdges
        Cache of edgeIndex.getNumEdges() so that hasNext() doesn't make an extra call
      • candidates

        java.util.ArrayList<java.lang.Integer> candidates
        All the candidates obtained by getCandidates() when we are using a quad-tree (i.e. isBruteForce = false).
      • currentIndexInCandidates

        private int currentIndexInCandidates
        Index within array above. We have: currentIndex = candidates.get(currentIndexInCandidates).
    • Constructor Detail

      • DataEdgeIterator

        public DataEdgeIterator​(S2EdgeIndex edgeIndex)
    • Method Detail

      • getCandidates

        public void getCandidates​(S2Point a,
                                  S2Point b)
        Initializes the iterator to iterate over a set of candidates that may cross the edge (a,b).
      • index

        public int index()
        Index of the current edge in the iteration.
      • hasNext

        public boolean hasNext()
        False if there are no more candidates; true otherwise.
      • next

        public void next()
        Iterate to the next available candidate.