Class GridCell<P extends GISPrimitive>

  • 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 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; otherwise false.
      • 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​(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; otherwise false.
      • removeElement

        public GridCellElement<P> removeElement​(P element)
        Remove the specified element from the cell.
        Parameters:
        element - the element.
        Returns:
        the removed grid-cell element.