Package com.google.common.geometry
Class S2ShapeIndexCoder.EncodedS2ShapeIndex.LazyCell
- java.lang.Object
-
- com.google.common.geometry.S2ShapeIndex.Cell
-
- com.google.common.geometry.S2ShapeIndexCoder.EncodedS2ShapeIndex.LazyCell
-
- All Implemented Interfaces:
S2Iterator.Entry
,java.io.Serializable
- Enclosing class:
- S2ShapeIndexCoder.EncodedS2ShapeIndex
private final class S2ShapeIndexCoder.EncodedS2ShapeIndex.LazyCell extends S2ShapeIndex.Cell
A lazy implementation ofS2ShapeIndex.Cell
which decodes members on demand.
-
-
Field Summary
Fields Modifier and Type Field Description private S2CellId
cachedCellId
private S2ShapeIndex.S2ClippedShape[]
cachedClippedShapes
private int
i
The index of this cell.
-
Constructor Summary
Constructors Constructor Description LazyCell(int i)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description S2ShapeIndex.S2ClippedShape
clipped(int i)
Returns the clipped shape at the given index.long
id()
Returns the cell ID of this cell as a primitive.private S2ShapeIndex.S2ClippedShape[]
loadClippedShapesFromCache()
ReturnscachedClippedShapes
if it's already cached.int
numShapes()
Returns the number of clipped shapes in this cell.-
Methods inherited from class com.google.common.geometry.S2ShapeIndex.Cell
create, findClipped
-
-
-
-
Field Detail
-
i
private final int i
The index of this cell.
-
cachedCellId
private S2CellId cachedCellId
-
cachedClippedShapes
private volatile S2ShapeIndex.S2ClippedShape[] cachedClippedShapes
-
-
Method Detail
-
loadClippedShapesFromCache
private S2ShapeIndex.S2ClippedShape[] loadClippedShapesFromCache()
ReturnscachedClippedShapes
if it's already cached. Otherwise, loads the clipped shapes fromS2ShapeIndexCoder.EncodedS2ShapeIndex.encodedCells
and stores it incachedClippedShapes
.
-
id
public long id()
Description copied from interface:S2Iterator.Entry
Returns the cell ID of this cell as a primitive.- Specified by:
id
in interfaceS2Iterator.Entry
- Overrides:
id
in classS2ShapeIndex.Cell
-
numShapes
public int numShapes()
Description copied from class:S2ShapeIndex.Cell
Returns the number of clipped shapes in this cell.- Specified by:
numShapes
in classS2ShapeIndex.Cell
-
clipped
public S2ShapeIndex.S2ClippedShape clipped(int i)
Description copied from class:S2ShapeIndex.Cell
Returns the clipped shape at the given index.- Specified by:
clipped
in classS2ShapeIndex.Cell
- Parameters:
i
- must be at least 0 and less thanS2ShapeIndex.Cell.numShapes()
-
-