Class LegacyCell
java.lang.Object
org.apache.lucene.spatial.prefix.tree.LegacyCell
- All Implemented Interfaces:
 Cell,CellCanPrune
- Direct Known Subclasses:
 QuadPrefixTree.QuadCell
The base for the original two SPT's: Geohash and Quad. Don't subclass this for new SPTs.
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected byte[]protected booleanprotected org.locationtech.spatial4j.shape.Shapeprotected org.locationtech.spatial4j.shape.SpatialRelationWhen set via getSubCells(filter), it is the relationship between this cell and the given shape filter. - 
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLegacyCell(byte[] bytes, int off, int len) Warning: Refers to the same bytes (no copy). - 
Method Summary
Modifier and TypeMethodDescriptionprotected static intcompare(byte[] aBytes, int aUpto, int a_length, byte[] bBytes, int bUpto, int b_length) Copied fromBytesRef.compareTo(BytesRef).intcompareToNoLeaf(Cell fromCell) Equivalent tothis.getTokenBytesNoLeaf(null).compareTo(fromCell.getTokenBytesNoLeaf(null)).booleanprotected abstract SpatialPrefixTreegetGrid()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 abstract intgetNextLevelCells(org.locationtech.spatial4j.shape.Shape shapeFilter) Gets the cells at the next grid cell level underneath this one, optionally filtered byshapeFilter.org.locationtech.spatial4j.shape.SpatialRelationGets the relationship this cell has with the shape from which it was filtered from, assuming it came from aCellIterator.protected abstract LegacyCellgetSubCell(org.locationtech.spatial4j.shape.Point p) Performant implementations are expected to implement this efficiently by considering the current cell's boundary.protected abstract 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.inthashCode()booleanisLeaf()Some cells are flagged as leaves, which are indexed as such.booleanisPrefixOf(Cell c) Returns if the target term is within/underneath this cell; not necessarily a direct descendant.protected voidprotected voidvoidsetLeaf()Set this cell to be a leaf.voidsetShapeRel(org.locationtech.spatial4j.shape.SpatialRelation rel) SeeCell.getShapeRel().toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.lucene.spatial.prefix.tree.CellCanPrune
getSubCellsSize 
- 
Field Details
- 
bytes
protected byte[] bytes - 
b_off
protected int b_off - 
b_len
protected int b_len - 
isLeaf
protected boolean isLeaf - 
shapeRel
protected org.locationtech.spatial4j.shape.SpatialRelation shapeRelWhen set via getSubCells(filter), it is the relationship between this cell and the given shape filter. Doesn't participate in shape equality. - 
shape
protected org.locationtech.spatial4j.shape.Shape shape 
 - 
 - 
Constructor Details
- 
LegacyCell
protected LegacyCell(byte[] bytes, int off, int len) Warning: Refers to the same bytes (no copy). IfsetLeaf()is subsequently called then it may modify bytes. 
 - 
 - 
Method Details
- 
readCell
 - 
readLeafAdjust
protected void readLeafAdjust() - 
getGrid
 - 
getMaxLevels
protected abstract int getMaxLevels() - 
getShapeRel
public org.locationtech.spatial4j.shape.SpatialRelation getShapeRel()Description copied from interface:CellGets the relationship this cell has with the shape from which it was filtered from, assuming it came from aCellIterator. Arguably it belongs there but it's very convenient here.- Specified by:
 getShapeRelin interfaceCell
 - 
setShapeRel
public void setShapeRel(org.locationtech.spatial4j.shape.SpatialRelation rel) Description copied from interface:CellSeeCell.getShapeRel().- Specified by:
 setShapeRelin interfaceCell
 - 
isLeaf
public boolean isLeaf()Description copied from interface:CellSome cells are flagged as leaves, which are indexed as such. A leaf cell is either within some shape or it both intersects and the cell is at an accuracy threshold such that no smaller cells for the shape will be represented. - 
setLeaf
public void setLeaf()Description copied from interface:CellSet this cell to be a leaf. Warning: never call on a cell initialized to reference the same bytes from termsEnum, which should be treated as immutable. Note: not supported at level 0. - 
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- 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- Parameters:
 result- where the result goes, or null to create new
 - 
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. - 
getNextLevelCells
Description copied from interface:CellGets the cells at the next grid cell level underneath this one, optionally filtered byshapeFilter. The returned cells should haveCell.getShapeRel()set to their relation withshapeFilter. In addition, for non-pointsCell.isLeaf()must be true when that relation is WITHIN.IMPORTANT: Cells returned from this iterator can be shared, as well as the bytes.
Precondition: Never called when getLevel() == maxLevel.
- Specified by:
 getNextLevelCellsin interfaceCell- Parameters:
 shapeFilter- an optional filter for the returned cells.- Returns:
 - A set of cells (no dups), sorted. Not Modifiable.
 
 - 
getSubCell
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.
 
 - 
getSubCells
Gets the cells at the next grid cell level that covers this cell. Precondition: Never called when getLevel() == maxLevel.- Returns:
 - A set of cells (no dups), sorted, modifiable, not empty, not null.
 
 - 
isPrefixOf
Description copied from interface:CellReturns if the target term is within/underneath this cell; not necessarily a direct descendant.- Specified by:
 isPrefixOfin interfaceCell- Parameters:
 c- the term
 - 
compareToNoLeaf
Description copied from interface:CellEquivalent tothis.getTokenBytesNoLeaf(null).compareTo(fromCell.getTokenBytesNoLeaf(null)).- Specified by:
 compareToNoLeafin interfaceCell
 - 
compare
protected static int compare(byte[] aBytes, int aUpto, int a_length, byte[] bBytes, int bUpto, int b_length) Copied fromBytesRef.compareTo(BytesRef). This is to avoid creating a BytesRef. - 
equals
 - 
hashCode
public int hashCode() - 
toString
 
 -