au.com.solidsoftware.multimahjong.shared
Class Wall

java.lang.Object
  |
  +--au.com.solidsoftware.multimahjong.shared.Wall

public class Wall
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

This forms the representation of the wall in a game of Mahjong. The class inserts given tiles into the back of the wall array and then draws from the back when tile is needed. Two walls are stored- the ordinary and honour walls. Tiles are drawn from the ordinary wall whenever a PICKUP is made from the Game. Tiles are drawn from the honour Wall whenever a player reveals or declares a Kong or when they extend a Pung into a Kong.

Author:
Dean Cortinovis
See Also:
Serialized Form

Field Summary
private  Tile[] honourWall
          Honour Wall of tiles
private  int tileCount
          Number of tiles that remain in the ordinary Wall.
private  Tile[] tilesInWall
          Ordinary Wall of tiles.
 
Constructor Summary
Wall()
          Class constuctor- creates storage for the Wall tiles.
 
Method Summary
 java.lang.Object clone()
          Allows the a copy of the wall to be made by the MMC.
 Tile drawLooseTile()
          Draws a tile from the back of the honour wall.
 Tile drawTile()
          Draws a tile from the back of the ordinary wall.
 int getTileCount()
          Returns the tile count.
 void insertLooseTile(Tile tile)
          Inserts a new tile at the end of the honour wall.
 void insertTile(Tile tile)
          Inserts a new tile at the end of the ordinary wall.
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

tilesInWall

private Tile[] tilesInWall
Ordinary Wall of tiles.

honourWall

private Tile[] honourWall
Honour Wall of tiles

tileCount

private int tileCount
Number of tiles that remain in the ordinary Wall.
Constructor Detail

Wall

public Wall()
Class constuctor- creates storage for the Wall tiles.

Method Detail

clone

public java.lang.Object clone()
Allows the a copy of the wall to be made by the MMC.
Overrides:
clone in class java.lang.Object

insertTile

public void insertTile(Tile tile)
Inserts a new tile at the end of the ordinary wall.

Parameters:
tile - New tile to insert into the ordinary wall.

drawTile

public Tile drawTile()
Draws a tile from the back of the ordinary wall. The tile is removed and returned.

Returns:
Tile drawn from the ordinary wall.

insertLooseTile

public void insertLooseTile(Tile tile)
Inserts a new tile at the end of the honour wall.

Parameters:
tile - New tile to insert into the honour wall.

drawLooseTile

public Tile drawLooseTile()
Draws a tile from the back of the honour wall. The tile is removed and returned.

Returns:
Tile drawn from the honour wall.

getTileCount

public int getTileCount()
Returns the tile count.

Returns:
Tile count.