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.Cellwhich decodes members on demand.
-
-
Field Summary
Fields Modifier and Type Field Description private S2CellIdcachedCellIdprivate S2ShapeIndex.S2ClippedShape[]cachedClippedShapesprivate intiThe 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.S2ClippedShapeclipped(int i)Returns the clipped shape at the given index.longid()Returns the cell ID of this cell as a primitive.private S2ShapeIndex.S2ClippedShape[]loadClippedShapesFromCache()ReturnscachedClippedShapesif it's already cached.intnumShapes()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()
ReturnscachedClippedShapesif it's already cached. Otherwise, loads the clipped shapes fromS2ShapeIndexCoder.EncodedS2ShapeIndex.encodedCellsand stores it incachedClippedShapes.
-
id
public long id()
Description copied from interface:S2Iterator.EntryReturns the cell ID of this cell as a primitive.- Specified by:
idin interfaceS2Iterator.Entry- Overrides:
idin classS2ShapeIndex.Cell
-
numShapes
public int numShapes()
Description copied from class:S2ShapeIndex.CellReturns the number of clipped shapes in this cell.- Specified by:
numShapesin classS2ShapeIndex.Cell
-
clipped
public S2ShapeIndex.S2ClippedShape clipped(int i)
Description copied from class:S2ShapeIndex.CellReturns the clipped shape at the given index.- Specified by:
clippedin classS2ShapeIndex.Cell- Parameters:
i- must be at least 0 and less thanS2ShapeIndex.Cell.numShapes()
-
-