bill.apps.wordfind
Class WordFind

java.lang.Object
  |
  +--bill.apps.wordfind.WordFind

public class WordFind
extends Object

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


Constructor Summary
WordFind()
          Class creator.
 
Method Summary
 void findWords()
          Controls the finding of words in the game grid.
 String getWordFile()
          Word list file name getter.
 int getWordListSize()
          Determines the number of words that are contained in the word list.
 void init()
           
 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 puzzle grid.
 void setFoundWordsList(JList list)
           
 void setHeight(int height)
           
 void setLetters(String letters)
          Sets up the puzzle board of letters that we will search for words.
 void setMaxLength(int maxLength)
           
 void setMinLength(int minLength)
           
 void setWidth(int width)
           
 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

WordFind

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

init

public void init()

setWidth

public void setWidth(int width)

setHeight

public void setHeight(int height)

setMaxLength

public void setMaxLength(int maxLength)

setMinLength

public void setMinLength(int minLength)

setFoundWordsList

public void setFoundWordsList(JList list)

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

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.

setLetters

public void setLetters(String letters)
Sets up the puzzle board of letters that we will search for words.
Parameters:
letters - String of letters to use in setting up the board.

getWordFile

public String getWordFile()
Word list file name getter.
Returns:
The name of the word list file

isWordMakeable

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

findWords

public void findWords()
Controls the finding of words in the game grid. This is done by building every possible word within the grid and checking to see if it a real word. If the user specified a large maximum word size this can take a long time!