|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.tabacha.cgo.Field
Just one field on the 19*19 board.
The minimum value of the row and the column is 0, the maximum value is ROW_COUNT-1 and COL_COUNT-1. (Both are defined in Constants.) But this class won't complain if the values are out of range; use method isOutside to test this.
This class does not contain any information about the board and the pieces thereon. To get these informations you have to use the methods of the classBoard
.
Field Summary |
Fields inherited from interface de.tabacha.cgo.Constants |
BALL, COL_COUNT, DCOL, DOWN, DROW, E, EMPTY, FIRST_DIRECTION, KICK_OFF_FIELD, LAST_DIRECTION, N, NE, NW, OPPOSITE, PIECE, ROW_COUNT, S, SE, SW, UP, UPSIDEDOWN, W |
Constructor Summary | |
Field(Field otherField)
Copy constructor. |
|
Field(int col,
int row)
Constructor. |
Method Summary | |
java.lang.Object |
clone()
|
int |
col()
|
boolean |
equals(java.lang.Object obj)
|
Field |
fieldIn(byte direction)
Returns the field that lies one step from this field in the specified direction. |
int |
hashCode()
|
boolean |
isInGoal()
Returns true if this field is in one of the goals. |
boolean |
isInGoalOf(boolean player)
Returns true if this field is in the goal of the specified player. |
boolean |
isOutside()
Returns true if this field is not on the board. |
static boolean |
isOutside(int col,
int row)
Returns true if the field with the specified row and column is not on the board. |
void |
moveIn(byte direction)
Changes the location of this field. |
int |
row()
|
void |
setCol(int newCol)
|
void |
setRow(int newRow)
|
java.lang.String |
toString()
|
Field |
upsideDown()
Returns the equivalent field on the other half of the board, mirrored along the central row. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Field(int col, int row)
row
- The row of the fieldcol
- The column of the fieldpublic Field(Field otherField)
otherField
- The field to be copied.
java.lang.NullPointerException
- If otherField is null.Method Detail |
public java.lang.Object clone()
public final Field fieldIn(byte direction)
direction
- One of the directions defined in Constants.
public final void moveIn(byte direction)
public boolean equals(java.lang.Object obj)
public final Field upsideDown()
public int hashCode()
public final boolean isOutside()
public static boolean isOutside(int col, int row)
public final boolean isInGoal()
public final boolean isInGoalOf(boolean player)
player
- One of the constants UP or DOWN defined in Constantspublic final int col()
public final int row()
public void setCol(int newCol)
public void setRow(int newRow)
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |