bill.apps.wordmaker
Class WordMaker

java.lang.Object
  |
  +--bill.apps.wordmaker.WordMaker

public class WordMaker
extends Object

This class controls the checking of the letter list for words.


Constructor Summary
WordMaker()
          Class creator.
 
Method Summary
 void findWords()
          Controls the finding of words in the given letters.
 Vector getLetters()
          Retrieves the list of letters available for making words out of.
 int getMinimumLength()
          Get the minimum length that words must be.
 int getWordListSize()
          Determines the number of words that are contained in the word list.
 void init()
          Clears out instance variables and resets them to an 'empty' status.
 boolean isValidWord(String word)
          Checks if the specified word is valid.
 boolean isWordMakeable(String word)
          Checks to see if the specified word can be spelled out using the available letters.
 void setFoundWordsList(JList list)
          Set the list component that we show the found word list on.
 void setLetters(String letters)
          Sets the list of letters available for making words out of.
 void setLetters(Vector letters)
          Sets the list of letters available for making words out of.
 void setMinimumLength(int minLength)
          Set the minimum length that words must be.
 void setWordList(WordList wordList)
          Word list setter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WordMaker

public WordMaker()
Class creator. Sets class variables to defaults.
Method Detail

init

public void init()
Clears out instance variables and resets them to an 'empty' status.

getWordListSize

public int getWordListSize()
Determines the number of words that are contained in the word list.
Returns:
The number of words.

setWordList

public void setWordList(WordList wordList)
Word list setter. Sets the class instance's word list to the provided list.
Parameters:
wordList - The word list to be used

getLetters

public Vector getLetters()
Retrieves the list of letters available for making words out of.
Returns:
The list of available letters, the Vector contains WordMakerLetter objects.

setLetters

public void setLetters(Vector letters)
Sets the list of letters available for making words out of.
Parameters:
letters - A Vector containing the letters that are available. Note that this must contain WordMakerLetter objects.

setLetters

public void setLetters(String letters)
Sets the list of letters available for making words out of.
Parameters:
letters - A String containing the letters that are available.

getMinimumLength

public int getMinimumLength()
Get the minimum length that words must be.
Returns:
The minimum number of characters that must be in a word.

setMinimumLength

public void setMinimumLength(int minLength)
Set the minimum length that words must be.
Parameters:
minLength - The minimum number of characters that must be in a word.

setFoundWordsList

public void setFoundWordsList(JList list)
Set the list component that we show the found word list on.
Parameters:
list - The list component to show the found words on.

findWords

public void findWords()
Controls the finding of words in the given letters. This requires looping through our available letters and attempting to build words out of them.

isValidWord

public boolean isValidWord(String word)
Checks if the specified word is valid. Valid means it is in the word list.
Parameters:
word - The word to check the validity of.
Returns:
Returns true if the word is valid, returns false otherwise.

isWordMakeable

public boolean isWordMakeable(String word)
Checks to see if the specified word can be spelled out using the available letters.
Parameters:
word - The word to check for.
Returns:
If the word can be made, true is returned, otherwise false is returned.