jrummikub.model
Class GameState

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

public class GameState
extends java.lang.Object
implements java.io.Serializable

Class that stores information for a game of multiple rounds

See Also:
Serialized Form

Field Summary
private  int firstRoundFirstPlayer
           
private  PlayerSettings lastPlayerRedealed
           
private  java.util.ArrayList<Score> scores
           
private static long serialVersionUID
           
 
Constructor Summary
GameState()
           
 
Method Summary
 Score getAccumulatedScore()
          Calculated the accumulated score over the played rounds
 int getFirstRoundFirstPlayer()
          Gets the number of the first player of the first round
 PlayerSettings getLastPlayerRedealed()
          Returns the player that has redealed last
 java.util.List<Score> getScores()
          Returns the list of players' scores in the rounds played before
private  java.lang.Boolean[] getWinners(java.lang.Integer[] points, int[] wins)
          Returns whether players have won
 void setFirstRoundFirstPlayer(int firstRoundFirstPlayer)
          Sets the number of the first player of the first round
 void setLastPlayerRedealed(PlayerSettings lastPlayerRedealed)
          Sets the player that has redealed last
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

firstRoundFirstPlayer

private int firstRoundFirstPlayer

scores

private java.util.ArrayList<Score> scores

lastPlayerRedealed

private PlayerSettings lastPlayerRedealed
Constructor Detail

GameState

public GameState()
Method Detail

getFirstRoundFirstPlayer

public int getFirstRoundFirstPlayer()
Gets the number of the first player of the first round

Returns:
the number of the first player of the first round

setFirstRoundFirstPlayer

public void setFirstRoundFirstPlayer(int firstRoundFirstPlayer)
Sets the number of the first player of the first round

Parameters:
firstRoundFirstPlayer - the number of the first player of the first round

setLastPlayerRedealed

public void setLastPlayerRedealed(PlayerSettings lastPlayerRedealed)
Sets the player that has redealed last

Parameters:
lastPlayerRedealed - the player to set

getLastPlayerRedealed

public PlayerSettings getLastPlayerRedealed()
Returns the player that has redealed last

Returns:
the player

getScores

public java.util.List<Score> getScores()
Returns the list of players' scores in the rounds played before

Returns:
the list of scores

getWinners

private java.lang.Boolean[] getWinners(java.lang.Integer[] points,
                                       int[] wins)
Returns whether players have won

Parameters:
points - the player's points
wins - the number of wins per player
Returns:
whether a player has won

getAccumulatedScore

public Score getAccumulatedScore()
Calculated the accumulated score over the played rounds

Returns:
the accumulated score