Package com.google.common.geometry
Class S2RegionCoverer.ActiveCovering
- java.lang.Object
-
- com.google.common.geometry.S2RegionCoverer.ActiveCovering
-
- Enclosing class:
- S2RegionCoverer
final class S2RegionCoverer.ActiveCovering extends java.lang.ObjectThis class tracks the state of a covering while it is underway.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.PriorityQueue<S2RegionCoverer.QueueEntry>candidateQueuePrioritized candidates to explore next.(package private) intcandidatesCreatedCounterCounter of number of candidates created, for performance evaluation.(package private) booleaninteriorCoveringTrue if we're covering the interior.(package private) S2RegionregionThe region being covered.(package private) java.util.ArrayList<S2CellId>resultCell ids that have been added to the covering so far.
-
Constructor Summary
Constructors Constructor Description ActiveCovering(boolean interior, S2Region region)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddCandidate(S2RegionCoverer.Candidate candidate)Process a candidate by either adding it to the result list or expanding its children and inserting it into the priority queue.private intexpandChildren(S2RegionCoverer.Candidate candidate, S2Cell cell, int numLevels)Populate the children of "candidate" by expanding the given number of levels from the given cell.private voidgetCoveringInternal()Generates a covering and stores it in result.private voidgetInitialCandidates()Computes a set of initial candidates that cover the given region.private intmaxChildrenShift()Return the log base 2 of the maximum number of children of a candidate.private S2RegionCoverer.CandidatenewCandidate(S2Cell cell)If the cell intersects the given region, return a new candidate with no children, otherwise return null.
-
-
-
Field Detail
-
interiorCovering
final boolean interiorCovering
True if we're covering the interior.
-
region
final S2Region region
The region being covered.
-
candidatesCreatedCounter
int candidatesCreatedCounter
Counter of number of candidates created, for performance evaluation.
-
result
final java.util.ArrayList<S2CellId> result
Cell ids that have been added to the covering so far.
-
candidateQueue
final java.util.PriorityQueue<S2RegionCoverer.QueueEntry> candidateQueue
Prioritized candidates to explore next.
-
-
Constructor Detail
-
ActiveCovering
ActiveCovering(boolean interior, S2Region region)
-
-
Method Detail
-
newCandidate
private S2RegionCoverer.Candidate newCandidate(S2Cell cell)
If the cell intersects the given region, return a new candidate with no children, otherwise return null. Also marks the candidate as "terminal" if it should not be expanded further.
-
maxChildrenShift
private int maxChildrenShift()
Return the log base 2 of the maximum number of children of a candidate.
-
addCandidate
private void addCandidate(S2RegionCoverer.Candidate candidate)
Process a candidate by either adding it to the result list or expanding its children and inserting it into the priority queue. Passing a null argument does nothing.
-
expandChildren
private int expandChildren(S2RegionCoverer.Candidate candidate, S2Cell cell, int numLevels)
Populate the children of "candidate" by expanding the given number of levels from the given cell. Returns the number of children that were marked "terminal".
-
getInitialCandidates
private void getInitialCandidates()
Computes a set of initial candidates that cover the given region.
-
getCoveringInternal
private void getCoveringInternal()
Generates a covering and stores it in result.
-
-