Module org.arakhne.afc.gis.giscore
Package org.arakhne.afc.gis.grid
Class GridCellElement<P extends GISPrimitive>
- java.lang.Object
-
- org.arakhne.afc.gis.grid.GridCellElement<P>
-
- Type Parameters:
P
- is the type of the user data inside the node.
- All Implemented Interfaces:
Comparable<GridCellElement<P>>
class GridCellElement<P extends GISPrimitive> extends Object implements Comparable<GridCellElement<P>>
Element inside a grid cell.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:53
- Author:
- Stéphane GALLAND
- See Also:
GISPrimitive
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- giscore
-
-
Constructor Summary
Constructors Constructor Description GridCellElement(P element)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addCellLink(GridCell<P> cell)
Add a reference from this element to a cell that is containing this element.int
compareTo(GridCellElement<P> obj)
List<GridCell<P>>
consumeCells()
Replies the cell on which the given element is located.boolean
equals(Object obj)
P
get()
Replies the element.int
hashCode()
boolean
isReferenceCell(GridCell<P> cell)
Replies if the specified cell is the reference cell for the element.boolean
removeCellLink(GridCell<P> cell)
Add a reference from this element to a cell that is containing this element.String
toString()
-
-
-
Constructor Detail
-
GridCellElement
GridCellElement(P element)
Constructor.- Parameters:
element
- the element.
-
-
Method Detail
-
addCellLink
public boolean addCellLink(GridCell<P> cell)
Add a reference from this element to a cell that is containing this element.- Parameters:
cell
- the grid cell.- Returns:
true
if the added cell is the reference;false
if the added cell is not the reference.
-
removeCellLink
public boolean removeCellLink(GridCell<P> cell)
Add a reference from this element to a cell that is containing this element.- Parameters:
cell
- the grid cell.- Returns:
true
if the removed cell is the reference;false
if the removed cell is not the reference.
-
consumeCells
public List<GridCell<P>> consumeCells()
Replies the cell on which the given element is located. The cell links were removed from the element.- Returns:
- a copy of the cells.
-
isReferenceCell
@Pure public boolean isReferenceCell(GridCell<P> cell)
Replies if the specified cell is the reference cell for the element. The reference cell is the cell where the element is supported to be attached when it is supposed by be inside only one cell.- Parameters:
cell
- is the cell to test- Returns:
true
if the specified cell is the reference cell;false
otherwise.
-
get
@Pure public P get()
Replies the element.- Returns:
- the element.
-
compareTo
@Pure public int compareTo(GridCellElement<P> obj)
- Specified by:
compareTo
in interfaceComparable<P extends GISPrimitive>
-
-