jrummikub.model
Class GameState

java.lang.Object
  extended by jrummikub.model.GameState
All Implemented Interfaces:
IGameState

public class GameState
extends java.lang.Object
implements IGameState

Class managing the overall and momentary GameState


Constructor Summary
GameState()
          Create a new GameState with an empty table and (currently) 4 new players.
 
Method Summary
 IPlayer getActivePlayer()
          Returns the currently active player
 StoneHeap getGameHeap()
          Returns the heap of stones to draw from
 IPlayer getNthNextPlayer(int i)
          Returns the player that would be the active player after i turns
 int getPlayerCount()
          Returns the number of players
 ITable getTable()
          Get the current Table
 void nextPlayer()
          Changes the activePlayer to the next Player in the list
 void setTable(ITable table)
          Sets the current Table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GameState

public GameState()
Create a new GameState with an empty table and (currently) 4 new players.

Method Detail

getTable

public ITable getTable()
Description copied from interface: IGameState
Get the current Table

Specified by:
getTable in interface IGameState
Returns:
The current Table

setTable

public void setTable(ITable table)
Description copied from interface: IGameState
Sets the current Table

Specified by:
setTable in interface IGameState
Parameters:
table - The new Table

getPlayerCount

public int getPlayerCount()
Description copied from interface: IGameState
Returns the number of players

Specified by:
getPlayerCount in interface IGameState
Returns:
number of players

nextPlayer

public void nextPlayer()
Description copied from interface: IGameState
Changes the activePlayer to the next Player in the list

Specified by:
nextPlayer in interface IGameState

getNthNextPlayer

public IPlayer getNthNextPlayer(int i)
Description copied from interface: IGameState
Returns the player that would be the active player after i turns

Specified by:
getNthNextPlayer in interface IGameState
Parameters:
i - number of turns
Returns:
player active after i turns

getActivePlayer

public IPlayer getActivePlayer()
Description copied from interface: IGameState
Returns the currently active player

Specified by:
getActivePlayer in interface IGameState
Returns:
currently active player

getGameHeap

public StoneHeap getGameHeap()
Description copied from interface: IGameState
Returns the heap of stones to draw from

Specified by:
getGameHeap in interface IGameState
Returns:
heap of stones