Class S2CellIndex.Delta

java.lang.Object
com.google.common.geometry.S2CellIndex.Delta
Enclosing class:
S2CellIndex

private static final class S2CellIndex.Delta extends Object
To build the cell tree and leaf cell ranges, we maintain a stack of (cellId, label) pairs that contain the current leaf cell. This class represents an instruction to push or pop a (cellId, label) pair.

If label >= 0, the (cellId, label) pair is pushed on the stack. If cellId == S2CellId.SENTINEL, a pair is popped from the stack. Otherwise the stack is unchanged but a RangeNode is still emitted.

  • Field Details

    • BY_START_CELL_NEG_LABEL

      public static final Comparator<S2CellIndex.Delta> BY_START_CELL_NEG_LABEL
      Deltas are sorted first by startId, then in reverse order by cellId, and then by label. This is necessary to ensure that (1) larger cells are pushed on the stack before smaller cells, and (2) cells are popped off the stack before any new cells are added.
    • startId

      private final S2CellId startId
    • cellId

      private final S2CellId cellId
    • label

      private final int label
  • Constructor Details