org.jogre.common.playerstate
Class PlayerState

java.lang.Object
  extended byorg.jogre.common.playerstate.PlayerState
Direct Known Subclasses:
PlayerStateGameStarted, PlayerStateReady, PlayerStateSeated, PlayerStateViewing

public abstract class PlayerState
extends Object

Class which describes the state of the various player when they join a table. This class employs the STATE design pattern from the GOF (gang of four).

Version:
Alpha 0.2.1
Author:
Bob Marks

Field Summary
static int GAME_STARTED
          Player is in the middle of a game at a table.
static int READY_TO_START
          Player is ready to start a table.
static int SEATED
          Player is seated at a table.
static int VIEWING
          Player is simply viewing a table.
 
Constructor Summary
PlayerState()
           
 
Method Summary
abstract  boolean canOfferDrawResign()
          Returns true if a user can offer a draw or resign.
abstract  boolean canSit(Table table)
          Returns true if a user can sit.
abstract  boolean canStand(Table table)
          Returns true if a user can stand.
abstract  boolean canStart(Table table)
          Returns true if a user can hit the start.
abstract  int intValue()
          Integer label of this state (see constants of this class).
abstract  PlayerState sit()
          Abstract method which defines what a player can do when they sit.
abstract  PlayerState stand()
          Abstract method which defines what a player can do when they stand up.
abstract  PlayerState start()
          Abstract method which defines what a player can do when they start.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VIEWING

public static final int VIEWING
Player is simply viewing a table.

See Also:
Constant Field Values

SEATED

public static final int SEATED
Player is seated at a table.

See Also:
Constant Field Values

READY_TO_START

public static final int READY_TO_START
Player is ready to start a table.

See Also:
Constant Field Values

GAME_STARTED

public static final int GAME_STARTED
Player is in the middle of a game at a table.

See Also:
Constant Field Values
Constructor Detail

PlayerState

public PlayerState()
Method Detail

sit

public abstract PlayerState sit()
Abstract method which defines what a player can do when they sit.

Returns:
PlayerState object.

stand

public abstract PlayerState stand()
Abstract method which defines what a player can do when they stand up.

Returns:
PlayerState object.

start

public abstract PlayerState start()
Abstract method which defines what a player can do when they start.

Returns:
PlayerState object.

canSit

public abstract boolean canSit(Table table)
Returns true if a user can sit.

Parameters:
table - Link to the table
Returns:
True if player can sit down.

canStand

public abstract boolean canStand(Table table)
Returns true if a user can stand.

Parameters:
table - Link to the table
Returns:
True if player can stand up.

canStart

public abstract boolean canStart(Table table)
Returns true if a user can hit the start.

Parameters:
table - Link to the table
Returns:
True if player can start.

canOfferDrawResign

public abstract boolean canOfferDrawResign()
Returns true if a user can offer a draw or resign.

Returns:
True if player offer a draw or resign.

intValue

public abstract int intValue()
Integer label of this state (see constants of this class).

Returns:
Integer value of this state.