|
Othello 1.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.drexel.cs.ai.othello.Square
public class Square
A class for representing an individual square in the othello board.
For a description of the string representation of Othello board
squares, see here.
| Constructor Summary | |
|---|---|
Square(int row,
int col)
Constructs a new Square from a given row and
column in the board. |
|
Square(java.lang.String square)
Constructs a new Square from a string
representation of the row and column. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object o)
Returns true if and only if the given object is
instanceof Square and if
o points to the same row and column as
this. |
int |
getCol()
Returns the column of this square. |
int |
getRow()
Returns the row of this square. |
int |
hashCode()
Returns a unique idendentifier for this square. |
java.lang.String |
toString()
Returns a string representation of this square. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Square(java.lang.String square)
throws java.lang.IllegalArgumentException
Square from a string
representation of the row and column. Rows are numbered
0–7 from top to bottom and columns are
labeled a–h from left to right.
a b c d e f g h
-----------------------------------------
0 | a0 | b0 | c0 | d0 | e0 | f0 | g0 | h0 |
-----------------------------------------
1 | a1 | b1 | c1 | d1 | e1 | f1 | g1 | h1 |
-----------------------------------------
2 | a2 | b2 | c2 | d2 | e2 | f2 | g2 | h2 |
-----------------------------------------
3 | a3 | b3 | c3 | d3 | e3 | f3 | g3 | h3 |
-----------------------------------------
4 | a4 | b4 | c4 | d4 | e4 | f4 | g4 | h4 |
-----------------------------------------
5 | a5 | b5 | c5 | d5 | e5 | f5 | g5 | h5 |
-----------------------------------------
6 | a6 | b6 | c6 | d6 | e6 | f6 | g6 | h6 |
-----------------------------------------
7 | a7 | b7 | c7 | d7 | e7 | f7 | g7 | h7 |
-----------------------------------------
The row and column may occur in any order; "c6" is equivalent to "6c".
java.lang.IllegalArgumentException - if a row and column could not be parsed from the string.
public Square(int row,
int col)
Square from a given row and
column in the board. Note that no checking is done to
ensure that the given arguments are within the bounds of the
standard 8x8 othello board. Also note that the
rows and columns are indexed from zero.
Square(String)| Method Detail |
|---|
public int getRow()
public int getCol()
public java.lang.String toString()
toString in class java.lang.ObjectSquare(String)public boolean equals(java.lang.Object o)
true if and only if the given object is
instanceof Square and if
o points to the same row and column as
this.
equals in class java.lang.Objectpublic int hashCode()
x.hashCode()==y.hashCode() implies
x.equals(y).
hashCode in class java.lang.Objectequals(Object)
|
Othello 1.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||