net.bluebones.boggle
Class Turn

java.lang.Object
  extended by net.bluebones.boggle.Turn
All Implemented Interfaces:
Serializable

public class Turn
extends Object
implements Serializable

Represents the result of a round for a given player.

Version:
0.3 $Revision: 1.3 $
Author:
Thomas David Baker
See Also:
Serialized Form

Constructor Summary
Turn(NamedClient namedClient, String[] words)
          Initialises a turn with the specified values.
 
Method Summary
 void addDuplicateWord(String word)
          Adds a word to the duplicate words held by this Turn.
 void addMisspeltWord(String word)
          Adds a word to the misspelt words held by this Turn.
 void addNotOnBoardWord(String word)
          Add the specified word to the list of words that were not on the board.
 void addTooShortWord(String word)
          Add the specified word to the list of words that were too short to add.
 void addUniqueWord(String word)
          Adds a unique word to the unique words held by this Turn.
 Set getDuplicateWords()
          Gets the duplicate words in this Turn.
 Set getMisspeltWords()
          Gets the misspelt words in this Turn.
 Set getNotOnBoardWords()
          Gets the not on board words in this Turn.
 Set getTooShortWords()
          Gets the too short words in this Turn.
 Set getUniqueWords()
          Gets the unique words in this Turn.
 String[] getWords()
          Gets all the words that form part of this Turn.
 boolean hasBeenMarked()
          Whether this Turn has been marked yet (by Round).
 NamedClient namedClient()
          Gets the NamedClient whose turn this is.
 int score()
          Gets the score that this Turn is worth.
 void setMarked(boolean value)
          Sets whether this turn has been marked or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Turn

public Turn(NamedClient namedClient,
            String[] words)
Initialises a turn with the specified values.

Parameters:
namedClient - NamedClient whose turn this is.
words - Words that this client came up with this turn.
Method Detail

score

public int score()
          throws IllegalStateException
Gets the score that this Turn is worth.

Returns:
This Turn's score.
Throws:
IllegalStateException - If this method is called before the Turn has been marked (by Round).
See Also:
Round

hasBeenMarked

public boolean hasBeenMarked()
Whether this Turn has been marked yet (by Round).

Returns:
boolean of whether this Turn has been marked yet.
See Also:
Round

setMarked

public void setMarked(boolean value)
Sets whether this turn has been marked or not.

Parameters:
value - boolean to set whether marked (true) or not (false).

getUniqueWords

public Set getUniqueWords()
Gets the unique words in this Turn.

Returns:
Set of Strings of the unique words.
Throws:
IllegalStateException - If this method is called before the Turn has been marked (by Round).
See Also:
Round

getDuplicateWords

public Set getDuplicateWords()
Gets the duplicate words in this Turn.

Returns:
Set of Strings of the duplicate words.
Throws:
IllegalStateException - If this method is called before the Turn has been marked (by Round).
See Also:
Round

getMisspeltWords

public Set getMisspeltWords()
Gets the misspelt words in this Turn.

Returns:
Set of Strings of the misspelt words.
Throws:
IllegalStateException - If this method is called before the Turn has been marked (by Round).
See Also:
Round

getTooShortWords

public Set getTooShortWords()
Gets the too short words in this Turn.

Returns:
Set of Strings of the too short words.
Throws:
IllegalStateException - If this method is called before the Turn has been marked (by Round).
See Also:
Round

getNotOnBoardWords

public Set getNotOnBoardWords()
Gets the not on board words in this Turn.

Returns:
Set of Strings of the not on board words.
Throws:
IllegalStateException - If this method is called before the Turn has been marked (by Round).
See Also:
Round

addUniqueWord

public void addUniqueWord(String word)
Adds a unique word to the unique words held by this Turn.

Parameters:
word - Word to add.

addDuplicateWord

public void addDuplicateWord(String word)
Adds a word to the duplicate words held by this Turn.

Parameters:
word - Word to add.

addMisspeltWord

public void addMisspeltWord(String word)
Adds a word to the misspelt words held by this Turn.

Parameters:
word - Word to add.

addNotOnBoardWord

public void addNotOnBoardWord(String word)
Add the specified word to the list of words that were not on the board.

Parameters:
word - String word to add.

addTooShortWord

public void addTooShortWord(String word)
Add the specified word to the list of words that were too short to add.

Parameters:
word - String word to add.

getWords

public String[] getWords()
Gets all the words that form part of this Turn.

Returns:
Array of all words in this Turn.

namedClient

public NamedClient namedClient()
Gets the NamedClient whose turn this is.

Returns:
NamedClient whose turn this is.