au.com.solidsoftware.multimahjong.shared
Class Moves

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

public class Moves
extends java.lang.Object
implements java.io.Serializable

The Moves class forms the storage unit to be sent to the Referee, and is to be retrieved by other MMC to receive all the necessary information that will keep them update to date. The Moves class will contain the last discarded tile from the current player, a flag to signal for Mahjong and a list of Kongs that they may have declared.

Author:
Dean Cortinovis
See Also:
Referee, Serialized Form

Field Summary
private  Tile[] declaredKongs
          List of tiles that have been declared by the current player.
private  int[] kongType
          Type of declared Kong made with tile.
private  Tile lastDiscard
          The last discarded tile.
static int MAX_SETS
          Maximum number of Sets expected to fill exposed or declared hands.
 
Constructor Summary
Moves()
          Initialises the declaredKongs and kongType arrays to null.
 
Method Summary
 void insertDeclaredKong(Tile givenTile, int givenType)
          Inserts declare Kong and pung2Kong tiles in the next position in the list.
 void placeDiscard(Tile lastDiscard)
          Inserts lastDiscard tile.
 Tile[] retrieveDeclaredKong()
          Returns list of tiles that have been selected as declared Kongs or pung2Kong tiles.
 Tile retrieveDiscard()
          Retrieves lastDiscard.
 int[] retrieveKongType()
          Returns list of types that match each tile in the declared Kong list.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

MAX_SETS

public static final int MAX_SETS
Maximum number of Sets expected to fill exposed or declared hands.

lastDiscard

private Tile lastDiscard
The last discarded tile.

declaredKongs

private Tile[] declaredKongs
List of tiles that have been declared by the current player.

kongType

private int[] kongType
Type of declared Kong made with tile.
Constructor Detail

Moves

public Moves()
Initialises the declaredKongs and kongType arrays to null.
Method Detail

placeDiscard

public void placeDiscard(Tile lastDiscard)
Inserts lastDiscard tile.

Parameters:
lastDiscard - last discarded tile from current player.

retrieveDiscard

public Tile retrieveDiscard()
Retrieves lastDiscard.

Returns:
last discarded tile from current player.

insertDeclaredKong

public void insertDeclaredKong(Tile givenTile,
                               int givenType)
Inserts declare Kong and pung2Kong tiles in the next position in the list.

Parameters:
givenTile - tile that has been selected to declare Kong or pung2Kong.
givenType - move selected with tile.

retrieveDeclaredKong

public Tile[] retrieveDeclaredKong()
Returns list of tiles that have been selected as declared Kongs or pung2Kong tiles.

Returns:
list of declare Kong and pung2Kong tiles.

retrieveKongType

public int[] retrieveKongType()
Returns list of types that match each tile in the declared Kong list.

Returns:
list of kong types.