- java.lang.Object
-
- org.joda.collect.grid.ImmutableCell<V>
-
- Type Parameters:
V
- the type of the value
- All Implemented Interfaces:
java.io.Serializable
,Grid.Cell<V>
public final class ImmutableCell<V> extends java.lang.Object implements java.io.Serializable
Immutable implementations of theGrid.Cell
data structure.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <R> ImmutableCell<R>
copyOf(Grid.Cell<? extends R> cell)
Obtains an instance ofCell
.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.static <R> ImmutableCell<R>
of(int row, int column, R value)
Obtains an instance ofCell
.java.lang.String
toString()
-
-
-
Method Detail
-
of
public static <R> ImmutableCell<R> of(int row, int column, R value)
Obtains an instance ofCell
.- Type Parameters:
R
- the type of the value- Parameters:
row
- the row, zero or greatercolumn
- the column, zero or greatervalue
- the value to put into the grid, not null- Returns:
- the immutable cell, not null
- Throws:
java.lang.IndexOutOfBoundsException
- if either index is less than zero
-
copyOf
public static <R> ImmutableCell<R> copyOf(Grid.Cell<? extends R> cell)
Obtains an instance ofCell
.- Type Parameters:
R
- the type of the value- Parameters:
cell
- the cell to copy, not null- Returns:
- the immutable cell, not null
-
getRow
public int getRow()
Description copied from interface:Grid.Cell
Gets the row index.
-
getColumn
public int getColumn()
Description copied from interface:Grid.Cell
Gets the column index.
-
getValue
public V getValue()
Description copied from interface:Grid.Cell
Gets the value of the cell.
-
equalRowColumn
public boolean equalRowColumn(int row, int column)
Description copied from interface:Grid.Cell
Checks if the row-column of this cell matches the specified row and column.- Specified by:
equalRowColumn
in interfaceGrid.Cell<V>
- Parameters:
row
- the row to checkcolumn
- the column to check- Returns:
- true if equal
-
equalValue
public boolean equalValue(java.lang.Object value)
Description copied from interface:Grid.Cell
Checks if the value of this cell matches the specified value.- Specified by:
equalValue
in interfaceGrid.Cell<V>
- Parameters:
value
- the row to check, null returns false- Returns:
- true if equal
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:Grid.Cell
Checks if this cell equals another cell.Two cells are equal if they have equal row, column and value.
-
hashCode
public int hashCode()
Description copied from interface:Grid.Cell
Gets a suitable hash code.The hash code is
row ^ Integer.rotateLeft(column, 16) ^ value.hashCode()
.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-