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

    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
    Checks if this cell equals another cell.
    boolean
    Checks if the value of this cell matches the specified value.
    int
    Gets the column index.
    int
    Gets the row index.
    Gets the value of the cell.
    int
    Gets a suitable hash code.
  • Method Details

    • 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(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(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 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 Object
      Returns:
      the hash code