Class S2EdgeIndex.DataEdgeIterator

java.lang.Object
com.google.common.geometry.S2EdgeIndex.DataEdgeIterator
Enclosing class:
S2EdgeIndex

public static class S2EdgeIndex.DataEdgeIterator extends 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) ArrayList<Integer>
    All the candidates obtained by getCandidates() when we are using a quad-tree (i.e.
    private int
    Index of the current edge and of the edge before the last next() call.
    private int
    Index within array above.
    private final S2EdgeIndex
    The structure containing the data edges.
    private boolean
    Tells whether getCandidates() obtained the candidates through brute force iteration or using the quad tree structure.
    private int
    Cache of edgeIndex.getNumEdges() so that hasNext() doesn't make an extra call
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Initializes the iterator to iterate over a set of candidates that may cross the edge (a,b).
    boolean
    False if there are no more candidates; true otherwise.
    int
    Index of the current edge in the iteration.
    void
    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 Details

    • 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

      ArrayList<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 Details

    • DataEdgeIterator

      public DataEdgeIterator(S2EdgeIndex edgeIndex)
  • Method Details

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