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

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

public class HumanSelection
extends java.lang.Object

HumanSelection synchronises the interaction between the Game and ActionPane when the user must make a selection on their next move. The Game thread activates the buttons in the ActionPane if a certain selection is possible. This is done through the Human class. Once all checks have been run the Game thread waits in this class until the user has made their selection.


Field Summary
(package private)  boolean selected
          Flag to signal that the player has made their selection.
(package private)  int selection
          Player's selected move.
 
Constructor Summary
HumanSelection()
           
 
Method Summary
 int getPlayerSelection()
          Used by the Game thread to retrieve the users selection.
 void setSelection(int selection)
          Is used to store the selection of the user, that will be retrieved by the Game thread.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

selected

boolean selected
Flag to signal that the player has made their selection.

selection

int selection
Player's selected move.
Constructor Detail

HumanSelection

public HumanSelection()
Method Detail

getPlayerSelection

public int getPlayerSelection()
Used by the Game thread to retrieve the users selection. Once the user has made a selection in the ActionPane, it is sent to this class. The thread is notified and returns the selection.

Returns:
The selection of the player.

setSelection

public void setSelection(int selection)
Is used to store the selection of the user, that will be retrieved by the Game thread. This is associated with the getPlayerSelection() function, which is notified when this is run and a selection has been placed.

Parameters:
selection - The player's selection.