net.bluebones.boggle
Class Dictionary

java.lang.Object
  extended by net.bluebones.boggle.Dictionary

public class Dictionary
extends Object

Represents a dictionary in which words can be checked for validity.

Version:
0.3 $Revision: 1.4 $
Author:
Thomas David Baker

Constructor Summary
Dictionary(File f)
          Initialises a Dictionary using the specified file.
Dictionary(InputStream is)
          Initialises a Dictionary using the specified InputStream.
 
Method Summary
 boolean isValid(String word)
          Determines if the specified word is valid (in the dictionary).
static void main(String[] args)
          Simple commandline test of Dictionary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dictionary

public Dictionary(File f)
           throws FileNotFoundException,
                  IOException
Initialises a Dictionary using the specified file.

Parameters:
f - File to use for the dictionary.
Throws:
FileNotFoundException - If the file cannot be found.
IOException - If there is any problem reading the dictionary.

Dictionary

public Dictionary(InputStream is)
           throws IOException
Initialises a Dictionary using the specified InputStream.

Parameters:
is - InputStream to initialise the dictionary from.
Throws:
IOException - If there is any problem reading the dictionary.
Method Detail

isValid

public boolean isValid(String word)
Determines if the specified word is valid (in the dictionary).

Parameters:
word - Word to check.
Returns:
boolean, true if the word is in the dictionary.

main

public static void main(String[] args)
                 throws FileNotFoundException,
                        IOException
Simple commandline test of Dictionary.

Parameters:
args - Commandline arguments.
Throws:
FileNotFoundException - If the file cannot be found.
IOException - If there is any problem reading the dictionary.