Class S2ShapeIndexCoder.EncodedS2ShapeIndex

  • All Implemented Interfaces:
    java.io.Serializable
    Enclosing class:
    S2ShapeIndexCoder

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

    This class is thread-safe.

    • Field Detail

      • UNDECODED_SHAPE

        private static final S2Shape UNDECODED_SHAPE
        Internal representation of an undecoded shape, which must be distinguished from a null shape.
      • 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.
    • Method Detail

      • 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
      • 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