au.com.solidsoftware.multimahjong.mmc.game
Class RetrieveMove

java.lang.Object
  |
  +--au.com.solidsoftware.multimahjong.mmc.game.RetrieveMove

public class RetrieveMove
extends java.lang.Object

RetrieveMove synchronises the interaction between Referee and the Game. When a discard tile is required to be received from another MMC, the Game waits in this class to receive the move.

Author:
Dean Cortinovis

Field Summary
private  Moves currentMove
          Holds tile associated with the current player's move.
private  boolean exit
          Exit flag
private  boolean stillRevealing
          Flag to signify current player still deciding whether to reveal tiles.
private  boolean tileAvailable
          Flag to signify change of discard.
 
Constructor Summary
RetrieveMove()
          Class Constructor.
 
Method Summary
 Moves getPlayerAction()
          Synchronised method that waits on placePlayerAction for the current player to make a move.
 void initMove()
          Initialise tile available and stillRevealing flags.
 boolean isRevealing()
          Returns isRevealing flag.
 void placePlayerAction(Moves givenMove, int action, boolean exit)
          Places the current player's tile and the associated action.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

currentMove

private Moves currentMove
Holds tile associated with the current player's move.

tileAvailable

private boolean tileAvailable
Flag to signify change of discard.

stillRevealing

private boolean stillRevealing
Flag to signify current player still deciding whether to reveal tiles.

exit

private boolean exit
Exit flag
Constructor Detail

RetrieveMove

public RetrieveMove()
Class Constructor.
Method Detail

initMove

public void initMove()
Initialise tile available and stillRevealing flags.

placePlayerAction

public void placePlayerAction(Moves givenMove,
                              int action,
                              boolean exit)
Places the current player's tile and the associated action. This is a synchronised method associated with placePlayerAction. Once the move is placed the Game is notified.

Parameters:
givenMove - Class containing the tile corresponding to the given action.
action - Player's selected action.
exit - Exit flag.

getPlayerAction

public Moves getPlayerAction()
Synchronised method that waits on placePlayerAction for the current player to make a move. The Referee sends the move to this class where it is retrieved by the Game.

Returns:
Move made by the player.

isRevealing

public boolean isRevealing()
Returns isRevealing flag. Signals whether the current player has discarded.

Returns:
True if current player hasn't discarded.