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
See binary representation in the javadocs of
PackedQuadPrefixTree.-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionintcompareToNoLeaf(Cell fromCell) Equivalent tothis.getTokenBytesNoLeaf(null).compareTo(fromCell.getTokenBytesNoLeaf(null)).protected longconcat(byte postfix) intgetLevel()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.QuadCellgetSubCell(org.locationtech.spatial4j.shape.Point p) Performant implementations are expected to implement this efficiently by considering the current cell's boundary.protected Collection<Cell> Gets the cells at the next grid cell level that covers this cell.getTokenBytesNoLeaf(BytesRef result) Returns the bytes for this cell, without a leaf set.getTokenBytesWithLeaf(BytesRef result) Returns the bytes for this cell, with a leaf byte if this is a leaf cell.booleanisEnd(int level, int shift) protected booleanbooleanisPrefixOf(Cell c) Returns if the target term is within/underneath this cell; not necessarily a direct descendant.protected org.locationtech.spatial4j.shape.RectangleConstructs a bounding box shape out of the encoded cellnextCell(boolean descend) Get the next cell in the tree without using recursion.protected voidprotected voidtoString()Used for debugging, this will print the bits of the cellMethods inherited from class org.apache.lucene.spatial.prefix.tree.QuadPrefixTree.QuadCell
concat, getGrid, getMaxLevels, getShape, getSubCellsSizeMethods inherited from class org.apache.lucene.spatial.prefix.tree.LegacyCell
compare, equals, getNextLevelCells, getShapeRel, hashCode, isLeaf, setLeaf, setShapeRel
-
Method Details
-
readCell
- Overrides:
readCellin classLegacyCell
-
isEnd
public boolean isEnd(int level, int shift) -
nextCell
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:
readLeafAdjustin classLegacyCell
-
getTokenBytesWithLeaf
Description copied from interface:CellReturns 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:
getTokenBytesWithLeafin interfaceCell- Overrides:
getTokenBytesWithLeafin classLegacyCell- Parameters:
result- where the result goes, or null to create new
-
getTokenBytesNoLeaf
Description copied from interface:CellReturns the bytes for this cell, without a leaf set. The bytes should sort beforeCell.getTokenBytesWithLeaf(org.apache.lucene.util.BytesRef). The result param is used to save object allocation, though its bytes aren't used.- Specified by:
getTokenBytesNoLeafin interfaceCell- Overrides:
getTokenBytesNoLeafin classLegacyCell- Parameters:
result- where the result goes, or null to create new
-
compareToNoLeaf
Description copied from interface:CellEquivalent tothis.getTokenBytesNoLeaf(null).compareTo(fromCell.getTokenBytesNoLeaf(null)).- Specified by:
compareToNoLeafin interfaceCell- Overrides:
compareToNoLeafin classLegacyCell
-
getLevel
public int getLevel()Description copied from interface:CellLevel 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:
getLevelin interfaceCell- Overrides:
getLevelin classLegacyCell
-
getSubCells
Description copied from class:LegacyCellGets the cells at the next grid cell level that covers this cell. Precondition: Never called when getLevel() == maxLevel.- Overrides:
getSubCellsin classQuadPrefixTree.QuadCell- Returns:
- A set of cells (no dups), sorted, modifiable, not empty, not null.
-
getSubCell
Description copied from class:LegacyCellPerformant 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:
getSubCellin classQuadPrefixTree.QuadCell
-
isPrefixOf
Description copied from interface:CellReturns if the target term is within/underneath this cell; not necessarily a direct descendant.- Specified by:
isPrefixOfin interfaceCell- Overrides:
isPrefixOfin classLegacyCell- Parameters:
c- the term
-
isInternalPrefix
-
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:
makeShapein classQuadPrefixTree.QuadCell
-
toString
Used for debugging, this will print the bits of the cell- Overrides:
toStringin classLegacyCell
-