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 booleanaddElement(GridCellElement<P> element)Add an element in the cell.intcolumn()Replies the column index of the cell.Rectangle2dgetBounds()Replies the bounds of the cell.PgetElementAt(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.intgetReferenceElementCount()Replies the number of elements that are inside this cell and for which this cell is the reference cell.intindexOf(P element)Replies the index of the specified element.booleanisEmpty()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.introw()Replies the row index of the cell.StringtoString()-
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:
trueif 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
-1if 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:
iteratorin 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:
trueif 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.
-
-