becker.xtras.jotto
Class JottoModel

java.lang.Object
  extended by becker.xtras.jotto.JottoModel
All Implemented Interfaces:
IObservable

public class JottoModel
extends Object
implements IObservable

JottoModel plays a game of Jotto. To run, it needs to be connected to an instance of JottoGUI. Significant parts of the class may be replaced with student-written code using various constructors.

Author:
Byron Weber Becker

Field Summary
static String[] LEVELS
           
static int MAX_GUESSES
           
static String NEW_GAME
           
static int NUM_LETTERS
           
 
Constructor Summary
JottoModel()
           
JottoModel(IWordList wl)
           
JottoModel(IWordList wl, IGuessEvaluator ge)
           
JottoModel(String aTarget, IWordList wordList, IGuessEvaluator guessEvaluator)
          Create a new instance of JottoModel to play the game.
 
Method Summary
 void addHint(Hint aHint)
           
 void addObserver(IObserver observer)
          Add an observer to a list of observers.
static void main(String[] args)
           
 void removeObserver(IObserver observer)
          Remove a specific observer from the list of observers.
 void removeObservers()
          Remove all the observers from the list of observers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEVELS

public static final String[] LEVELS

MAX_GUESSES

public static final int MAX_GUESSES
See Also:
Constant Field Values

NUM_LETTERS

public static final int NUM_LETTERS
See Also:
Constant Field Values

NEW_GAME

public static final String NEW_GAME
See Also:
Constant Field Values
Constructor Detail

JottoModel

public JottoModel()

JottoModel

public JottoModel(IWordList wl)

JottoModel

public JottoModel(IWordList wl,
                  IGuessEvaluator ge)

JottoModel

public JottoModel(String aTarget,
                  IWordList wordList,
                  IGuessEvaluator guessEvaluator)
Create a new instance of JottoModel to play the game.

Parameters:
aTarget - The word the user will try to guess
wordList - A list of valid words.
Method Detail

addHint

public void addHint(Hint aHint)

removeObservers

public void removeObservers()
Description copied from interface: IObservable
Remove all the observers from the list of observers.

Specified by:
removeObservers in interface IObservable

removeObserver

public void removeObserver(IObserver observer)
Description copied from interface: IObservable
Remove a specific observer from the list of observers.

Specified by:
removeObserver in interface IObservable
Parameters:
observer - The observer to remove.

addObserver

public void addObserver(IObserver observer)
Description copied from interface: IObservable
Add an observer to a list of observers. Observers are notified each time an event occurs that changes the state of the observable.

Specified by:
addObserver in interface IObservable
Parameters:
observer - The observer to add.

main

public static void main(String[] args)