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

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

public class RetrieveSelection
extends java.lang.Object

RetrieveSelection synchronises the interaction between Referee and the Game. Once all selections have been sent by the Game to the Referee it will call on this to wait for the selection determined to have the highest priority.

Author:
Dean Cortinovis

Field Summary
private  int currentPlayer
          Winning player- now becomes the current player.
private  boolean exit
          Exit flag.
private  boolean resultAvail
          Flag to signal that winning move has been placed.
private  int winningSelection
          Winning selection
 
Constructor Summary
RetrieveSelection()
           
 
Method Summary
 int getBestSelection()
          Returns the selection of the player who was given the highest priority.
 int getResult()
          Waits until a result is able to be made available and returns the player's position with the highest priority.
 void initTurn()
          Class initialisation- run after every move to clear selections.
 void placeResult(int winningSelection, int currentPlayer, boolean exit)
          Inserts a winning player and their selection.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

winningSelection

private int winningSelection
Winning selection

resultAvail

private boolean resultAvail
Flag to signal that winning move has been placed.

currentPlayer

private int currentPlayer
Winning player- now becomes the current player.

exit

private boolean exit
Exit flag.
Constructor Detail

RetrieveSelection

public RetrieveSelection()
Method Detail

initTurn

public void initTurn()
Class initialisation- run after every move to clear selections. Resets the resultAvail flag to stop the game accessing the previous turns results.

placeResult

public void placeResult(int winningSelection,
                        int currentPlayer,
                        boolean exit)
Inserts a winning player and their selection.

Parameters:
winningSelection - Players selection.
currentPlayer - The new current player.
exit - Exit flag.

getResult

public int getResult()
Waits until a result is able to be made available and returns the player's position with the highest priority.

Returns:
The new current player. The player's move that has the highest priority.

getBestSelection

public int getBestSelection()
Returns the selection of the player who was given the highest priority.

Returns:
The selection made by the player who has the highest ranking move.