Interface Grid.Cell<V>

  • Type Parameters:
    V - the type of the value
    All Known Implementing Classes:
    ImmutableCell
    Enclosing interface:
    Grid<V>

    public static interface Grid.Cell<V>
    A cell within the grid compared only using row and column.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean equalRowColumn​(int row, int column)
      Checks if the row-column of this cell matches the specified row and column.
      boolean equals​(java.lang.Object obj)
      Checks if this cell equals another cell.
      boolean equalValue​(java.lang.Object value)
      Checks if the value of this cell matches the specified value.
      int getColumn()
      Gets the column index.
      int getRow()
      Gets the row index.
      V getValue()
      Gets the value of the cell.
      int hashCode()
      Gets a suitable hash code.
    • Method Detail

      • getRow

        int getRow()
        Gets the row index.
        Returns:
        the row, zero or greater
      • getColumn

        int getColumn()
        Gets the column index.
        Returns:
        the column, zero or greater
      • getValue

        V getValue()
        Gets the value of the cell.
        Returns:
        the cell value, not null
      • equalRowColumn

        boolean equalRowColumn​(int row,
                               int column)
        Checks if the row-column of this cell matches the specified row and column.
        Parameters:
        row - the row to check
        column - the column to check
        Returns:
        true if equal
      • equalValue

        boolean equalValue​(java.lang.Object value)
        Checks if the value of this cell matches the specified value.
        Parameters:
        value - the row to check, null returns false
        Returns:
        true if equal
      • equals

        boolean equals​(java.lang.Object obj)
        Checks if this cell equals another cell.

        Two cells are equal if they have equal row, column and value.

        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the object to compare to, null returns false
        Returns:
        true if equal
      • hashCode

        int hashCode()
        Gets a suitable hash code.

        The hash code is row ^ Integer.rotateLeft(column, 16) ^ value.hashCode().

        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hash code