Package com.google.common.geometry
Class S2ShapeIndex.EdgeAllocator
java.lang.Object
com.google.common.geometry.S2ShapeIndex.EdgeAllocator
- Enclosing class:
S2ShapeIndex
This class provides temporary storage for new ClippedEdges that are created during indexing. It
is essentially a stack-based object pool, where edges are allocated as the recursion goes down
the first time, put back in the pool as recursion come back up, and reused when recursion goes
back down another branch of the S2Cell tree.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
size
private int size -
edges
-
-
Constructor Details
-
EdgeAllocator
public EdgeAllocator(int maxEdges)
-
-
Method Details
-
create
Returns an edge. -
size
public int size()Returns the number of allocated edges. Before a thread callscreate()
, this method should be called to assess the size of the stack, and after all created edges are no longer needed, callreset(int)
with the previous size. -
reset
public void reset(int size) Returns all edges after 'size' to the object pool to be reused by another thread.
-