Module org.arakhne.afc.gis.giscore
Package org.arakhne.afc.gis.grid
Class GridCell<P extends GISPrimitive>
- java.lang.Object
-
- org.arakhne.afc.gis.grid.GridCell<P>
-
- Type Parameters:
P
- is the type of the user data inside the node.
- All Implemented Interfaces:
Iterable<P>
class GridCell<P extends GISPrimitive> extends Object implements Iterable<P>
Element of the grid.- 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 GridCell(int row, int column, Rectangle2d bounds)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addElement(GridCellElement<P> element)
Add an element in the cell.int
column()
Replies the column index of the cell.Rectangle2d
getBounds()
Replies the bounds of the cell.P
getElementAt(int index)
Replies the reference element at the specified index in this cell.Iterator<GridCellElement<P>>
getGridCellElements()
Replies the grid cell elements in this cell.int
getReferenceElementCount()
Replies the number of elements that are inside this cell and for which this cell is the reference cell.int
indexOf(P element)
Replies the index of the specified element.boolean
isEmpty()
Replies if the cell is empty, or not.Iterator<P>
iterator()
Iterator<P>
iterator(Rectangle2afp<?,?,?,?,?,?> bounds)
Replies the iterator on the elements of the cell that are intersecting the specified bounds.GridCellElement<P>
removeElement(P element)
Remove the specified element from the cell.int
row()
Replies the row index of the cell.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
GridCell
GridCell(int row, int column, Rectangle2d bounds)
Constructor.- Parameters:
row
- is the row index of the cell.column
- is the column index of the cell.bounds
- are the bounds of the grid cell.
-
-
Method Detail
-
isEmpty
@Pure public boolean isEmpty()
Replies if the cell is empty, or not.- Returns:
true
if the cell is empty; otherwisefalse
.
-
getReferenceElementCount
@Pure public int getReferenceElementCount()
Replies the number of elements that are inside this cell and for which this cell is the reference cell.- Returns:
- the referenced cells.
-
getElementAt
@Pure public P getElementAt(int index)
Replies the reference element at the specified index in this cell.- Parameters:
index
- the index.- Returns:
- the element.
-
indexOf
@Pure public int indexOf(P element)
Replies the index of the specified element.- Parameters:
element
- the element.- Returns:
- the index of the specified element or
-1
if it was not found.
-
row
@Pure public int row()
Replies the row index of the cell.- Returns:
- the row index of the cell.
-
column
@Pure public int column()
Replies the column index of the cell.- Returns:
- the column index of the cell.
-
getBounds
@Pure public Rectangle2d getBounds()
Replies the bounds of the cell.- Returns:
- the cell.
-
iterator
@Pure public Iterator<P> iterator()
- Specified by:
iterator
in interfaceIterable<P extends GISPrimitive>
-
iterator
@Pure public Iterator<P> iterator(Rectangle2afp<?,?,?,?,?,?> bounds)
Replies the iterator on the elements of the cell that are intersecting the specified bounds.- Parameters:
bounds
- the bounds- Returns:
- the iterator.
-
getGridCellElements
@Pure public Iterator<GridCellElement<P>> getGridCellElements()
Replies the grid cell elements in this cell.- Returns:
- the grid cell elements in this cell.
-
addElement
public boolean addElement(GridCellElement<P> element)
Add an element in the cell.- Parameters:
element
- the element.- Returns:
true
if the element is added; otherwisefalse
.
-
removeElement
public GridCellElement<P> removeElement(P element)
Remove the specified element from the cell.- Parameters:
element
- the element.- Returns:
- the removed grid-cell element.
-
-