Package com.google.common.geometry
Class S2EdgeIndex.DataEdgeIterator
java.lang.Object
com.google.common.geometry.S2EdgeIndex.DataEdgeIterator
- Enclosing class:
S2EdgeIndex
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
FieldsModifier and TypeFieldDescriptionAll 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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.
-
Field Details
-
edgeIndex
The structure containing the data edges. -
isBruteForce
private boolean isBruteForceTells whether getCandidates() obtained the candidates through brute force iteration or using the quad tree structure. -
currentIndex
private int currentIndexIndex of the current edge and of the edge before the last next() call. -
numEdges
private int numEdgesCache of edgeIndex.getNumEdges() so that hasNext() doesn't make an extra call -
candidates
All the candidates obtained by getCandidates() when we are using a quad-tree (i.e. isBruteForce = false). -
currentIndexInCandidates
private int currentIndexInCandidatesIndex within array above. We have: currentIndex = candidates.get(currentIndexInCandidates).
-
-
Constructor Details
-
DataEdgeIterator
-
-
Method Details
-
getCandidates
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.
-