Class S2ShapeIndexCoder.EncodedS2ShapeIndex

java.lang.Object
com.google.common.geometry.S2ShapeIndex
com.google.common.geometry.S2ShapeIndexCoder.EncodedS2ShapeIndex
All Implemented Interfaces:
Serializable
Enclosing class:
S2ShapeIndexCoder

private static final class S2ShapeIndexCoder.EncodedS2ShapeIndex extends S2ShapeIndex
Represents an encoded S2ShapeIndex.

This class is thread-safe.

  • Field Details

    • UNDECODED_SHAPE

      private static final S2Shape UNDECODED_SHAPE
      Internal representation of an undecoded shape, which must be distinguished from a null shape.
    • options

      private final S2ShapeIndex.Options options
      The decoded options of this index.
    • cachedShapes

      private final S2Shape[] cachedShapes
      The array of not-yet-decoded and decoded shapes. The default value is UNDECODED_SHAPE. A value of null represents a null shape.
    • encodedCellIds

      private final S2CellIdVector encodedCellIds
      The encoded vector of cell IDs of this index.
    • encodedCells

      private final List<S2ShapeIndex.S2ClippedShape[]> encodedCells
      The encoded cells of this index.
    • decodedCells

      private final List<S2ShapeIndex.Cell> decodedCells
      The list of S2ShapeIndex.Cells.
    • clippedShapeArrayCoder

      private final S2Coder<S2ShapeIndex.S2ClippedShape[]> clippedShapeArrayCoder
      A coder of S2ClippedShape[]s.
  • Constructor Details

  • Method Details

    • options

      public S2ShapeIndex.Options options()
      Description copied from class: S2ShapeIndex
      Returns the options used for this index.
      Overrides:
      options in class S2ShapeIndex
    • add

      public void add(S2Shape shape)
      Description copied from class: S2ShapeIndex
      Adds the given shape to this index. Invalidates all iterators and their associated data.
      Overrides:
      add in class S2ShapeIndex
    • remove

      public void remove(S2Shape shape)
      Description copied from class: S2ShapeIndex
      Currently not implemented. Will eventually remove the given shape from the index, and invalidate all iterators and their associated data.
      Overrides:
      remove in class S2ShapeIndex
      Parameters:
      shape - the shape to remove
    • reset

      public void reset()
      Description copied from class: S2ShapeIndex
      Clears the contents of the index and resets it to its original state.
      Overrides:
      reset in class S2ShapeIndex
    • iterator

      public S2Iterator<S2ShapeIndex.Cell> iterator()
      Description copied from class: S2ShapeIndex
      Returns a new iterator over the cells of this index, positioned at the first cell in the index, after initializing any pending updates.
      Overrides:
      iterator in class S2ShapeIndex
    • isFresh

      public boolean isFresh()
      Description copied from class: S2ShapeIndex
      Returns true if there are no pending updates that need to be applied. This can be useful to avoid building the index unnecessarily, or for choosing between two different algorithms depending on whether the index is available.
      Overrides:
      isFresh in class S2ShapeIndex
    • applyUpdates

      void applyUpdates()
      Description copied from class: S2ShapeIndex
      Ensures pending updates have been applied, returning immediately if the index is fresh as reported by S2ShapeIndex.isFresh(), and otherwise blocking while the index is built.

      This operation is thread safe, guarded by 'this'.

      Overrides:
      applyUpdates in class S2ShapeIndex