au.com.solidsoftware.multimahjong.mmc.game
Class HumanDiscard
java.lang.Object
|
+--au.com.solidsoftware.multimahjong.mmc.game.HumanDiscard
- public class HumanDiscard
- extends java.lang.Object
HumanDiscard synchronises the interaction between the
Game and PlayArea when the user must select to
declare Kong, extend a Pung or discard. The Game thread
notifies the PlayArea that a discard is required and waits
on this class to receive the users selection.
- Author:
- Dean Cortinovis
|
Field Summary |
private int |
move
Selected move of the player. |
private boolean |
selected
Flag to signal that a selected move has been placed. |
private Tile |
selectedTile
Tile that goes with the selected move. |
|
Method Summary |
int |
getDiscard(Moves currentMove)
Is used by the Game thread to retrieve the
users selected move. |
Tile |
getSelectedTile()
Retrieves the selected tile by the user. |
void |
setMove(Tile selectedTile,
int move)
SetMove is run to store the selected tile and the move from
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 |
selected
private boolean selected
- Flag to signal that a selected move has been placed.
move
private int move
- Selected move of the player.
selectedTile
private Tile selectedTile
- Tile that goes with the selected move.
HumanDiscard
public HumanDiscard()
- Class constructor.
getDiscard
public int getDiscard(Moves currentMove)
- Is used by the
Game thread to retrieve the
users selected move. While a move hasn't been selected the
thread will wait until it is notified by the ActionPane.
Once the selection is made the move and tile associated with the move is
placed into the Moves class.
- Parameters:
currentMove - Location for where the moves and tiles are placed.- Returns:
- Selected move of the player.
setMove
public void setMove(Tile selectedTile,
int move)
SetMove is run to store the selected tile and the move from
the user, that will be retrieved by the Game thread. This is
associated with the getDiscard() function, which is notified
when this is run and a move has been placed.
- Parameters:
selectedTile - Tile selected by the user.move - Selected move to be made with the tile.
getSelectedTile
public Tile getSelectedTile()
- Retrieves the selected tile by the user.
- Returns:
- Selected tile of the user.