ks.domain
Class Status

java.lang.Object
  extended byks.domain.Status
All Implemented Interfaces:
java.io.Serializable

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

Encapsulates the status of a game as it is being played.

Also maintains numerous statistics about the way in which the game was played. There are two forms of statistics. Incrementable and Settable. Increment: numLosses, numWins, numNewHands, numResetHands, numUndoRequests Settable: numCardsLeft, score

The most important statistics from the end-game are: numWins, score, and numUndoRequests since these will be used to determine the winner.

Creation date: (10/11/01 9:41:23 PM)

See Also:
Serialized Form

Constructor Summary
Status()
          Status constructor comment.
Status(java.lang.String user, int numHandsWon, int overallScore)
          Status constructor comment.
 
Method Summary
 int getBestScore()
          Returns best score of the current hand (current score plus best so far).
 int getCurrentScore()
          Returns score of the current hand (across multiple games).
 int getNewHands()
          Return number of times user requested a new hand.
 int getNumCardsLeft()
          Returns the number of cards left.
 int getNumLosses()
          Returns the number of times the player has lost on this table.
 int getNumResetHands()
          Returns the number of times the user has chosen to reset the deck.
 int getNumUndoRequests()
          Returns number of times user requested an undo.
 int getNumWins()
          Returns number of times user has won during this table.
 int getScore()
          Returns score of table (in current hand).
 java.lang.String getUser()
          Returns the user associated with this Status.
 void incrementNumLosses()
          Increment the number of losses sustained on this table.
 void incrementNumNewHands()
          Increment number of times user selected a new hand.
 void incrementNumResetHands()
          Increment the number of times user has reset hand.
 void incrementNumWins()
          Increment the number of wins.
 void incrementUndoRequests()
          Increase the number of undo requests.
 java.lang.String playerRankings()
          Output relevant data useful for updating player rankings (user:numWins:overallScore) Creation date: (10/22/01 10:06:26 PM)
 void setCurrentScore(int newCurrentScore)
          Set the current score.
 void setNumCardsLeft(int newNumCardsLeft)
          Sets the number of cards left.
 void setUser(java.lang.String user)
          Sets the name of the user associated with these statistics.
 void updateCurrentScore()
          Updating the current score tallies the points into the overall score and resets to zero to avoid multiple calls from affecting the score more than once.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Status

public Status()
Status constructor comment.


Status

public Status(java.lang.String user,
              int numHandsWon,
              int overallScore)
Status constructor comment. Useful when constructing object from information contained in playerRankings() output.

Method Detail

getBestScore

public int getBestScore()
Returns best score of the current hand (current score plus best so far).

Returns:
int

getCurrentScore

public int getCurrentScore()
Returns score of the current hand (across multiple games). Creation date: (10/11/01 9:42:57 PM)

Returns:
int

getNewHands

public int getNewHands()
Return number of times user requested a new hand. Creation date: (10/13/01 4:53:46 PM)

Returns:
int

getNumCardsLeft

public int getNumCardsLeft()
Returns the number of cards left. Creation date: (10/11/01 9:42:45 PM)

Returns:
int

getNumLosses

public int getNumLosses()
Returns the number of times the player has lost on this table. Creation date: (10/11/01 9:42:06 PM)

Returns:
int

getNumResetHands

public int getNumResetHands()
Returns the number of times the user has chosen to reset the deck. Creation date: (10/11/01 9:42:20 PM)

Returns:
int

getNumUndoRequests

public int getNumUndoRequests()
Returns number of times user requested an undo. Creation date: (10/11/01 9:42:34 PM)

Returns:
int

getNumWins

public int getNumWins()
Returns number of times user has won during this table. Creation date: (10/11/01 9:41:58 PM)

Returns:
int

getScore

public int getScore()
Returns score of table (in current hand). Creation date: (10/11/01 9:42:57 PM)

Returns:
int

getUser

public java.lang.String getUser()
Returns the user associated with this Status. Creation date: (10/13/01 5:44:48 PM)

Returns:
java.lang.String

incrementNumLosses

public void incrementNumLosses()
Increment the number of losses sustained on this table.


incrementNumNewHands

public void incrementNumNewHands()
Increment number of times user selected a new hand. By doing so, all points so far are accumulated into the total score, and then current score is reset.


incrementNumResetHands

public void incrementNumResetHands()
Increment the number of times user has reset hand. By doing so, all points for this hand are cleared.


incrementNumWins

public void incrementNumWins()
Increment the number of wins. Add currentScore into the total and then resets. Wins are immediately recorded/recognized, which is why the points are added in.


incrementUndoRequests

public void incrementUndoRequests()
Increase the number of undo requests.


playerRankings

public java.lang.String playerRankings()
Output relevant data useful for updating player rankings (user:numWins:overallScore) Creation date: (10/22/01 10:06:26 PM)

Returns:
java.lang.String

setCurrentScore

public void setCurrentScore(int newCurrentScore)
Set the current score. Must be a set and not an increment because can change up or down. Creation date: (10/11/01 9:42:57 PM)

Parameters:
newCurrentScore - int

setNumCardsLeft

public void setNumCardsLeft(int newNumCardsLeft)
Sets the number of cards left. Must be a set and not an increment because can change up or down. Creation date: (10/11/01 9:42:45 PM)

Parameters:
newNumCardsLeft - int

setUser

public void setUser(java.lang.String user)
Sets the name of the user associated with these statistics. Creation date: (10/13/01 5:36:31 PM)

Parameters:
user - java.lang.String

updateCurrentScore

public void updateCurrentScore()
Updating the current score tallies the points into the overall score and resets to zero to avoid multiple calls from affecting the score more than once.

Creation date: (10/11/01 9:48:17 PM)

Since:
V1.7