assignment2
Class HumanPlayer

java.lang.Object
  extended by assignment2.AbstractPlayer
      extended by assignment2.HumanPlayer
All Implemented Interfaces:
IPlayer, java.lang.Iterable<java.lang.String>

public class HumanPlayer
extends AbstractPlayer

Boggle player that interacts with a human player. Duplicate words generate an error, words not in lexicon generate an error. The errors are shown via an associated view.


Field Summary
 
Fields inherited from class assignment2.AbstractPlayer
myLexicon, myScore, myScoreKeeper, myView, myWords
 
Constructor Summary
HumanPlayer(ILexicon lex, java.lang.String name)
           
 
Method Summary
 boolean add(java.lang.String word)
          Add word if the word is in the lexicon and isn't a duplicate.
 java.lang.String getName()
          Returns name of this player.
 
Methods inherited from class assignment2.AbstractPlayer
clear, getScore, initialize, iterator, setView, wordCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HumanPlayer

public HumanPlayer(ILexicon lex,
                   java.lang.String name)
Method Detail

add

public boolean add(java.lang.String word)
Add word if the word is in the lexicon and isn't a duplicate. Update score appropriately via call to AbstractPlayer (super). Show word found on the associated View of this player.

Specified by:
add in interface IPlayer
Overrides:
add in class AbstractPlayer
Parameters:
word - is the word added to this player
Returns:
true if the word was added, false otherwise

getName

public java.lang.String getName()
Returns name of this player.

Specified by:
getName in interface IPlayer
Specified by:
getName in class AbstractPlayer
Returns:
name of this human player