Modifier and Type | Field and Description |
---|---|
protected boolean |
isLeaf |
protected com.spatial4j.core.shape.Shape |
shape |
protected com.spatial4j.core.shape.SpatialRelation |
shapeRel
When set via getSubCells(filter), it is the relationship between this cell
and the given shape filter.
|
Modifier | Constructor and Description |
---|---|
protected |
LegacyCell(byte[] bytes,
int off,
int len)
Warning: Refers to the same bytes (no copy).
|
Modifier and Type | Method and Description |
---|---|
int |
compareToNoLeaf(Cell fromCell)
Equivalent to
this.getTokenBytesNoLeaf(null).compareTo(fromCell.getTokenBytesNoLeaf(null)) . |
boolean |
equals(Object obj) |
protected abstract SpatialPrefixTree |
getGrid() |
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.
|
CellIterator |
getNextLevelCells(com.spatial4j.core.shape.Shape shapeFilter)
Gets the cells at the next grid cell level underneath this one, optionally filtered by
shapeFilter . |
com.spatial4j.core.shape.SpatialRelation |
getShapeRel()
Gets the relationship this cell has with the shape from which it was filtered from, assuming it came from a
CellIterator . |
protected abstract LegacyCell |
getSubCell(com.spatial4j.core.shape.Point p)
Performant implementations are expected to implement this efficiently by
considering the current cell's boundary.
|
protected abstract Collection<Cell> |
getSubCells()
Gets the cells at the next grid cell level that covers this cell.
|
abstract int |
getSubCellsSize()
getSubCells() .size() -- usually a constant. |
BytesRef |
getTokenBytesNoLeaf(BytesRef result)
Returns the bytes for this cell, without leaf set.
|
BytesRef |
getTokenBytesWithLeaf(BytesRef result)
Returns the bytes for this cell, with a leaf byte if this is a leaf cell.
|
int |
hashCode() |
boolean |
isLeaf()
Some cells are flagged as leaves, which are indexed as such.
|
boolean |
isPrefixOf(Cell c)
Returns if the target term is within/underneath this cell; not necessarily a direct
descendant.
|
protected void |
readCell(BytesRef bytes) |
void |
setLeaf()
Set this cell to be a leaf.
|
void |
setShapeRel(com.spatial4j.core.shape.SpatialRelation rel)
See
Cell.getShapeRel() . |
String |
toString() |
protected boolean isLeaf
protected com.spatial4j.core.shape.SpatialRelation shapeRel
protected com.spatial4j.core.shape.Shape shape
protected LegacyCell(byte[] bytes, int off, int len)
setLeaf()
is subsequently called then it
may modify bytes.protected void readCell(BytesRef bytes)
protected abstract SpatialPrefixTree getGrid()
public com.spatial4j.core.shape.SpatialRelation getShapeRel()
Cell
CellIterator
. Arguably it belongs there but it's very convenient here.getShapeRel
in interface Cell
public void setShapeRel(com.spatial4j.core.shape.SpatialRelation rel)
Cell
Cell.getShapeRel()
.setShapeRel
in interface Cell
public boolean isLeaf()
Cell
public void setLeaf()
Cell
public BytesRef getTokenBytesWithLeaf(BytesRef result)
Cell
getTokenBytesWithLeaf
in interface Cell
result
- where the result goes, or null to create newpublic BytesRef getTokenBytesNoLeaf(BytesRef result)
Cell
Cell.getTokenBytesWithLeaf(org.apache.lucene.util.BytesRef)
.
The result param is used to save object allocation, though its bytes aren't used.getTokenBytesNoLeaf
in interface Cell
result
- where the result goes, or null to create newpublic int getLevel()
Cell
public CellIterator getNextLevelCells(com.spatial4j.core.shape.Shape shapeFilter)
Cell
shapeFilter
. The returned cells should have Cell.getShapeRel()
set to
their relation with shapeFilter
. In addition, for non-points Cell.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.getNextLevelCells
in interface Cell
shapeFilter
- an optional filter for the returned cells.protected abstract LegacyCell getSubCell(com.spatial4j.core.shape.Point p)
protected abstract Collection<Cell> getSubCells()
public abstract int getSubCellsSize()
getSubCells()
.size() -- usually a constant. Should be >=2public boolean isPrefixOf(Cell c)
Cell
isPrefixOf
in interface Cell
c
- the termpublic int compareToNoLeaf(Cell fromCell)
Cell
this.getTokenBytesNoLeaf(null).compareTo(fromCell.getTokenBytesNoLeaf(null))
.compareToNoLeaf
in interface Cell
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.