org.apache.lucene.spatial.prefix.tree

## Class PackedQuadPrefixTree.PackedQuadCell

- java.lang.Object
- - org.apache.lucene.spatial.prefix.tree.LegacyCell
  - - org.apache.lucene.spatial.prefix.tree.QuadPrefixTree.QuadCell
    - - org.apache.lucene.spatial.prefix.tree.PackedQuadPrefixTree.PackedQuadCell

- All Implemented Interfaces:
    Cell, CellCanPrune
  Enclosing class:
    PackedQuadPrefixTree

      protected class PackedQuadPrefixTree.PackedQuadCell
      extends QuadPrefixTree.QuadCell

  See binary representation in the javadocs of `PackedQuadPrefixTree`.

- - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.spatial.prefix.tree.LegacyCell

      `b_len, b_off, bytes, isLeaf, shape, shapeRel`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareToNoLeaf(Cell fromCell)` Equivalent to `this.getTokenBytesNoLeaf(null).compareTo(fromCell.getTokenBytesNoLeaf(null))`.
    `protected long` | `concat(byte postfix)`
    `int` | `getLevel()` Level 0 is the world (and has no parent), from then on a higher level means a smaller cell than the level before it.
    `protected QuadPrefixTree.QuadCell` | `getSubCell(org.locationtech.spatial4j.shape.Point p)` Performant implementations are expected to implement this efficiently by considering the current cell's boundary.
    `protected Collection<Cell>` | `getSubCells()` Gets the cells at the next grid cell level that covers this cell.
    `BytesRef` | `getTokenBytesNoLeaf(BytesRef result)` Returns the bytes for this cell, without a leaf set.
    `BytesRef` | `getTokenBytesWithLeaf(BytesRef result)` Returns the bytes for this cell, with a leaf byte if this is a leaf cell.
    `boolean` | `isEnd(int level, int shift)`
    `protected boolean` | `isInternalPrefix(PackedQuadPrefixTree.PackedQuadCell c)`
    `boolean` | `isPrefixOf(Cell c)` Returns if the target term is within/underneath this cell; not necessarily a direct descendant.
    `protected org.locationtech.spatial4j.shape.Rectangle` | `makeShape()` Constructs a bounding box shape out of the encoded cell
    `PackedQuadPrefixTree.PackedQuadCell` | `nextCell(boolean descend)` Get the next cell in the tree without using recursion.
    `protected void` | `readCell(BytesRef bytes)`
    `protected void` | `readLeafAdjust()`
    `String` | `toString()` Used for debugging, this will print the bits of the cell

    - ### Methods inherited from class org.apache.lucene.spatial.prefix.tree.QuadPrefixTree.QuadCell

      `concat, getGrid, getMaxLevels, getShape, getSubCellsSize`

    - ### Methods inherited from class org.apache.lucene.spatial.prefix.tree.LegacyCell

      `compare, equals, getNextLevelCells, getShapeRel, hashCode, isLeaf, setLeaf, setShapeRel`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### readCell

          protected void readCell(BytesRef bytes)

      Overrides:
        `readCell` in class `LegacyCell`

    - #### isEnd

          public boolean isEnd(int level,
                               int shift)

    - #### nextCell

          public PackedQuadPrefixTree.PackedQuadCell nextCell(boolean descend)

      Get the next cell in the tree without using recursion. descend parameter requests traversal to the child nodes, setting this to false will step to the next sibling. Note: This complies with lexicographical ordering, once you've moved to the next sibling there is no backtracking.

    - #### readLeafAdjust

          protected void readLeafAdjust()

      Overrides:
        `readLeafAdjust` in class `LegacyCell`

    - #### getTokenBytesWithLeaf

          public BytesRef getTokenBytesWithLeaf(BytesRef result)

      Description copied from interface: `Cell`
      Returns the bytes for this cell, with a leaf byte if this is a leaf cell. The result param is used to save object allocation, though its bytes aren't used.
      Specified by:
        `getTokenBytesWithLeaf` in interface `Cell`
      Overrides:
        `getTokenBytesWithLeaf` in class `LegacyCell`
      Parameters:
        `result` - where the result goes, or null to create new

    - #### getTokenBytesNoLeaf

          public BytesRef getTokenBytesNoLeaf(BytesRef result)

      Description copied from interface: `Cell`
      Returns the bytes for this cell, without a leaf set. The bytes should sort before `Cell.getTokenBytesWithLeaf(org.apache.lucene.util.BytesRef)`. The result param is used to save object allocation, though its bytes aren't used.
      Specified by:
        `getTokenBytesNoLeaf` in interface `Cell`
      Overrides:
        `getTokenBytesNoLeaf` in class `LegacyCell`
      Parameters:
        `result` - where the result goes, or null to create new

    - #### compareToNoLeaf

          public int compareToNoLeaf(Cell fromCell)

      Description copied from interface: `Cell`
      Equivalent to `this.getTokenBytesNoLeaf(null).compareTo(fromCell.getTokenBytesNoLeaf(null))`.
      Specified by:
        `compareToNoLeaf` in interface `Cell`
      Overrides:
        `compareToNoLeaf` in class `LegacyCell`

    - #### getLevel

          public int getLevel()

      Description copied from interface: `Cell`
      Level 0 is the world (and has no parent), from then on a higher level means a smaller cell than the level before it.
      Specified by:
        `getLevel` in interface `Cell`
      Overrides:
        `getLevel` in class `LegacyCell`

    - #### getSubCells

          protected Collection<Cell> getSubCells()

      Description copied from class: `LegacyCell`
      Gets the cells at the next grid cell level that covers this cell. Precondition: Never called when getLevel() == maxLevel.
      Overrides:
        `getSubCells` in class `QuadPrefixTree.QuadCell`
      Returns:
        A set of cells (no dups), sorted, modifiable, not empty, not null.

    - #### getSubCell

          protected QuadPrefixTree.QuadCell getSubCell(org.locationtech.spatial4j.shape.Point p)

      Description copied from class: `LegacyCell`
      Performant implementations are expected to implement this efficiently by considering the current cell's boundary.

      Precondition: Never called when getLevel() == maxLevel. Precondition: this.getShape().relate(p) != DISJOINT.

      Overrides:
        `getSubCell` in class `QuadPrefixTree.QuadCell`

    - #### isPrefixOf

          public boolean isPrefixOf(Cell c)

      Description copied from interface: `Cell`
      Returns if the target term is within/underneath this cell; not necessarily a direct descendant.
      Specified by:
        `isPrefixOf` in interface `Cell`
      Overrides:
        `isPrefixOf` in class `LegacyCell`
      Parameters:
        `c` - the term

    - #### isInternalPrefix

          protected boolean isInternalPrefix(PackedQuadPrefixTree.PackedQuadCell c)

    - #### concat

          protected long concat(byte postfix)

    - #### makeShape

          protected org.locationtech.spatial4j.shape.Rectangle makeShape()

      Constructs a bounding box shape out of the encoded cell
      Overrides:
        `makeShape` in class `QuadPrefixTree.QuadCell`

    - #### toString

          public String toString()

      Used for debugging, this will print the bits of the cell
      Overrides:
        `toString` in class `LegacyCell`

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.