becker.xtras.jotto
Class Word

java.lang.Object
  extended by becker.xtras.jotto.Word

public class Word
extends Object

Store one word together with its difficulty.

Author:
Byron Weber Becker

Constructor Summary
Word(Scanner in)
          Read one word from an open file.
Word(String aWord, int aLevel)
          Construct a new Word object.
 
Method Summary
 int getDifficulty()
          Get the difficulty level.
 String getWord()
          Get the word.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Word

public Word(Scanner in)
Read one word from an open file.

File format is a word followed by its difficulty, one pair per line. The difficulty must be in the range of 0..2. The file cursor is expected immediately before the word and will be left immediately before the following word in the file. For example:

TRUCK 0
FOLLY 1
LIGHT 0
EMBAY 2
...

Parameters:
in - An open input file.

Word

public Word(String aWord,
            int aLevel)
Construct a new Word object.

Parameters:
aWord - a word with the length specified by JottoModel.NUM_LETTERS
aLevel - a difficulty level. One of {0, 1, 2}.
Method Detail

getDifficulty

public int getDifficulty()
Get the difficulty level.

Returns:
the word's difficulty level

getWord

public String getWord()
Get the word.

Returns:
the word.