|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmahjong.Board
public class Board
This class represents a mahjong board with tiles in it.
Field Summary | |
---|---|
private Tile[][][] |
content
The actual board is a 3d array of Tile objects. |
static int |
GROUPSIZE
Constant number of tiles in a group. |
private int |
height
Dimensions of a layer. |
static int |
MAXGROUPS
Constant number of groups. |
private java.util.Random |
r
The random variable used to construct the board. |
private int |
width
Dimensions of a layer. |
Constructor Summary | |
---|---|
Board(java.util.Random r1,
java.lang.String boardName)
Construct a new board from a given template file, but using a given (seeded) random variable. |
|
Board(java.lang.String boardName)
Construct a new board from a given template file. |
Method Summary | |
---|---|
protected void |
build(java.util.Random r1)
Basic setup routine. |
boolean |
free(Tile t)
Return true if the given tile is free. |
Tile[][][] |
getContent()
Getter. |
int |
getHeight()
Getter. |
int |
getWidth()
Getter. |
boolean |
isEmpty()
Check if the board is empty or not. |
boolean |
remove(Tile t)
Attempt to remove the given tile; the tile must be present. |
void |
reset()
Wipes the current board and constructs a new one using the current Random variable. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int GROUPSIZE
public static final int MAXGROUPS
private java.util.Random r
private Tile[][][] content
private int height
private int width
Constructor Detail |
---|
public Board(java.lang.String boardName)
boardName
- template file name.public Board(java.util.Random r1, java.lang.String boardName)
boardName
- template file name.r1
- the random variable to use.Method Detail |
---|
protected void build(java.util.Random r1)
r1
- the random number generator to use.public void reset()
public boolean isEmpty()
public boolean remove(Tile t)
t
- the tile to remove.
public boolean free(Tile t)
t
- The Tile to check.
public Tile[][][] getContent()
public int getWidth()
public int getHeight()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |