assignment2
Class BoardCell
java.lang.Object
assignment2.BoardCell
- All Implemented Interfaces:
- java.lang.Comparable<BoardCell>
public class BoardCell
- extends java.lang.Object
- implements java.lang.Comparable<BoardCell>
Encapsulate a (row,column) entry so that the entry
can be hashed, compared, and stored as a single
entry.
Method Summary |
int |
compareTo(BoardCell cell)
Returns value indicating whether cell is less
than, equal to, or greater than this cell as determined
first by row value, then by column value for
cells whose rows are equal |
boolean |
equals(java.lang.Object o)
|
int |
hashCode()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
row
public final int row
col
public final int col
BoardCell
public BoardCell(int r,
int c)
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
compareTo
public int compareTo(BoardCell cell)
- Returns value indicating whether cell is less
than, equal to, or greater than this cell as determined
first by row value, then by column value for
cells whose rows are equal
- Specified by:
compareTo
in interface java.lang.Comparable<BoardCell>
- Parameters:
cell
- compared to this BoardCell
- Returns:
- row difference if rows aren't the same,
column difference if rows are the same
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object