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
An
Edges
implementation optimized for merging edges from multiple S2ClippedShapes
already in sorted order.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final PriorityQueue
<S2EdgeQuery.Stepper> (package private) S2EdgeQuery.Stepper
The top of the priority queue (the stepper which currently has the least value forcurrentEdge
). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(S2ShapeIndex.S2ClippedShape shape) Note:shape
should have at least one edge.boolean
isEmpty()
Returns true if there are no more edges.int
nextEdge()
Returns the next edge ID, or throws an exception if empty.private void
removeFromPriorityQueue
(int n) Updates the priority queuesteppers
so that no stepper in the queue will returnn
ifcurrentEdge()
is called on it.
-
Field Details
-
steppers
-
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.
-
-
Constructor Details
-
MergedEdges
private MergedEdges()
-
-
Method Details
-
add
Note:shape
should have at least one edge. -
nextEdge
public int nextEdge()Description copied from interface:S2EdgeQuery.Edges
Returns the next edge ID, or throws an exception if empty.- Specified by:
nextEdge
in interfaceS2EdgeQuery.Edges
-
removeFromPriorityQueue
private void removeFromPriorityQueue(int n) Updates the priority queuesteppers
so that no stepper in the queue will returnn
ifcurrentEdge()
is called on it. -
isEmpty
public boolean isEmpty()Description copied from interface:S2EdgeQuery.Edges
Returns true if there are no more edges.- Specified by:
isEmpty
in interfaceS2EdgeQuery.Edges
-