Package com.google.common.geometry
Class S2EdgeQuery.MergedEdges
- java.lang.Object
-
- com.google.common.geometry.S2EdgeQuery.MergedEdges
-
- All Implemented Interfaces:
S2EdgeQuery.Edges
- Enclosing class:
- S2EdgeQuery
private static final class S2EdgeQuery.MergedEdges extends java.lang.Object implements S2EdgeQuery.Edges
AnEdgesimplementation optimized for merging edges from multiple S2ClippedShapes already in sorted order.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.PriorityQueue<S2EdgeQuery.Stepper>steppers(package private) S2EdgeQuery.SteppertopThe top of the priority queue (the stepper which currently has the least value forcurrentEdge).
-
Constructor Summary
Constructors Modifier Constructor Description privateMergedEdges()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(S2ShapeIndex.S2ClippedShape shape)Note:shapeshould have at least one edge.booleanisEmpty()Returns true if there are no more edges.intnextEdge()Returns the next edge ID, or throws an exception if empty.private voidremoveFromPriorityQueue(int n)Updates the priority queuesteppersso that no stepper in the queue will returnnifcurrentEdge()is called on it.
-
-
-
Field Detail
-
steppers
final java.util.PriorityQueue<S2EdgeQuery.Stepper> steppers
-
top
S2EdgeQuery.Stepper top
The top of the priority queue (the stepper which currently has the least value forcurrentEdge). It is stored separately as an optimization, to avoid repeatedly adding and polling it from the top of the queue.
-
-
Method Detail
-
add
public void add(S2ShapeIndex.S2ClippedShape shape)
Note:shapeshould have at least one edge.
-
nextEdge
public int nextEdge()
Description copied from interface:S2EdgeQuery.EdgesReturns the next edge ID, or throws an exception if empty.- Specified by:
nextEdgein interfaceS2EdgeQuery.Edges
-
removeFromPriorityQueue
private void removeFromPriorityQueue(int n)
Updates the priority queuesteppersso that no stepper in the queue will returnnifcurrentEdge()is called on it.
-
isEmpty
public boolean isEmpty()
Description copied from interface:S2EdgeQuery.EdgesReturns true if there are no more edges.- Specified by:
isEmptyin interfaceS2EdgeQuery.Edges
-
-