Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.spatial.prefix.tree
Class Cell

    java.lang.Object
      org.apache.lucene.spatial.prefix.tree.Cell

All Implemented Interfaces:
  Comparable<Cell>

    public abstract class Cell

extends Object
implements Comparable<Cell>

Represents a grid cell. These are not necessarily thread-safe, although new Cell("") (world cell) must be.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Field Summary
`protected boolean` | `leaf` Always false for points.
`static byte` | `LEAF_BYTE`
`protected com.spatial4j.core.shape.SpatialRelation` | `shapeRel` When set via getSubCells(filter), it is the relationship between this cell and the given shape filter.

Constructor Summary
`protected` | `Cell(byte[] bytes, int off, int len)`
`protected` | `Cell(String token)`

Method Summary
`int` | `compareTo(Cell o)`
`boolean` | `equals(Object obj)`
`com.spatial4j.core.shape.Point` | `getCenter()`
`int` | `getLevel()`
`abstract com.spatial4j.core.shape.Shape` | `getShape()`
`com.spatial4j.core.shape.SpatialRelation` | `getShapeRel()`
`abstract Cell` | `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 cover this cell.
`Collection<Cell>` | `getSubCells(com.spatial4j.core.shape.Shape shapeFilter)` Like `getSubCells()` but with the results filtered by a shape.
`abstract int` | `getSubCellsSize()` `getSubCells()`.size() -- usually a constant.
`byte[]` | `getTokenBytes()` Note: doesn't contain a trailing leaf byte.
`String` | `getTokenString()` Note: doesn't contain a trailing leaf byte.
`int` | `hashCode()`
`boolean` | `isLeaf()` For points, this is always false.
`void` | `reset(byte[] bytes, int off, int len)`
`void` | `setLeaf()` Note: not supported at level 0.
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### LEAF_BYTE

    public static final byte LEAF_BYTE

See Also:
  Constant Field Values

### shapeRel

    protected com.spatial4j.core.shape.SpatialRelation shapeRel

  When set via getSubCells(filter), it is the relationship between this cell and the given shape filter.

### leaf

    protected boolean leaf

  Always false for points. Otherwise, indicate no further sub-cells are going to be provided because shapeRel is WITHIN or maxLevels or a detailLevel is hit.

Constructor Detail

### Cell

    protected Cell(String token)

### Cell

    protected Cell(byte[] bytes,
                   int off,
                   int len)

Method Detail

### reset

    public void reset(byte[] bytes,
                      int off,
                      int len)

### getShapeRel

    public com.spatial4j.core.shape.SpatialRelation getShapeRel()

### isLeaf

    public boolean isLeaf()

  For points, this is always false. Otherwise this is true if there are no further cells with this prefix for the shape (always true at maxLevels).

### setLeaf

    public void setLeaf()

  Note: not supported at level 0.

### getTokenString

    public String getTokenString()

  Note: doesn't contain a trailing leaf byte.

### getTokenBytes

    public byte[] getTokenBytes()

  Note: doesn't contain a trailing leaf byte.

### getLevel

    public int getLevel()

### getSubCells

    public Collection<Cell> getSubCells(com.spatial4j.core.shape.Shape shapeFilter)

  Like `getSubCells()` but with the results filtered by a shape. If that shape is a `Point` then it must call `getSubCell(com.spatial4j.core.shape.Point)`. The returned cells should have `getShapeRel()` set to their relation with `shapeFilter`. In addition, `isLeaf()` must be true when that relation is WITHIN.

  Precondition: Never called when getLevel() == maxLevel.

  Parameters:
    `shapeFilter` - an optional filter for the returned cells.
  Returns:
    A set of cells (no dups), sorted. Not Modifiable.

### getSubCell

    public abstract Cell getSubCell(com.spatial4j.core.shape.Point p)

  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

    protected abstract Collection<Cell> getSubCells()

  Gets the cells at the next grid cell level that cover this cell. Precondition: Never called when getLevel() == maxLevel.

  Returns:
    A set of cells (no dups), sorted, modifiable, not empty, not null.

### getSubCellsSize

    public abstract int getSubCellsSize()

  `getSubCells()`.size() -- usually a constant. Should be >=2

### getShape

    public abstract com.spatial4j.core.shape.Shape getShape()

### getCenter

    public com.spatial4j.core.shape.Point getCenter()

### compareTo

    public int compareTo(Cell o)

  Specified by:
    `compareTo` in interface `Comparable<Cell>`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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