|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectBoard
public class Board
The class Board
represents the board with all pieces and holes.
Field Summary | |
---|---|
static java.lang.String |
ERR_INVALID_BOARD_SIZE
error message: invalid board size |
static java.lang.String |
ERR_INVALID_SITUATION_CHAR
error message: invalid character in situation string |
int |
height
the height of the board |
static int |
MAX_HEIGHT
minimum width of an Othello-Game board |
static int |
MAX_WIDTH
minimum width of an Othello-Game board |
static int |
MIN_HEIGHT
minimum width of an Othello-Game board |
static int |
MIN_WIDTH
minimum width of an Othello-Game board |
int |
width
the width of the board |
Constructor Summary | |
---|---|
Board(int width,
int height)
Constructor for a board object. |
|
Board(int width,
int height,
java.lang.String situation)
Constructor for a board object. |
Method Summary | |
---|---|
static boolean |
checkBoardSize(int width,
int height)
Check if the board size is valid. |
Field |
get(int x,
int y)
Get the piece at the position (x|y). |
Field |
get(Position position)
Get the piece at the position. |
boolean |
isPositionOnBoard(Position pos)
Checks if a position is on the board. |
static boolean |
isSituationStringValid(int width,
int height,
java.lang.String situation)
Checks if the given situation string is valid. |
java.lang.String |
niceRepresentation()
This method returns a nice representation of the board. |
void |
set(int x,
int y,
Field player)
This method sets a piece or a hole on the board. |
void |
set(Position pos,
Field player)
This method sets a piece or a hole on the board. |
java.lang.String |
toString()
Returns the String representation of a board object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ERR_INVALID_SITUATION_CHAR
public static final java.lang.String ERR_INVALID_BOARD_SIZE
public static final int MIN_WIDTH
public static final int MAX_WIDTH
public static final int MIN_HEIGHT
public static final int MAX_HEIGHT
public final int width
public final int height
Constructor Detail |
---|
public Board(int width, int height)
width
- the width of the boardheight
- the height of the boardpublic Board(int width, int height, java.lang.String situation)
width
- the width of the boardheight
- the height of the boardsituation
- the situation of the new boardMethod Detail |
---|
public static boolean checkBoardSize(int width, int height)
width
- the width of the boardheight
- the height of the board
true
if the board size is valid, otherwise false
public static boolean isSituationStringValid(int width, int height, java.lang.String situation)
width
- the width of the boardheight
- the height of the boardsituation
- the situation string
true
if the string is valid for this board, otherwise false
public void set(int x, int y, Field player)
x
- The x-coordinatey
- The y-coordinateplayer
- The player who wants to set the piecepublic void set(Position pos, Field player)
pos
- the position where you want to set the new pieceplayer
- The player who wants to set the piecepublic Field get(int x, int y)
x
- the x-coordinate of the piece you want to gety
- the y-coordinate of the piece you want to get
null
public Field get(Position position)
position
- the position of the piece you want to get
null
public boolean isPositionOnBoard(Position pos)
pos
- the positon you want to check
true
if the position is on the board, otherwise false
public java.lang.String niceRepresentation()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |