Class WordBank

java.lang.Object
   |
   +----WordBank

public class WordBank
extends Object
implements Serializable
Stores words in a tree (Trie structure)


Constructor Index

 o WordBank()
 o WordBank(int)
constructor: maxlen is maximum length a word may have to be allowed into the bank

Method Index

 o add(String)
add word to bank.
 o exists(String)
returns true if word is in bank
 o getMaxLength()
returns maximum allowed length of word in this instance of the WordBank object
 o getTree()
returns Trie data structure that words are stored in
 o load(String)
 o loadWords(String)
include all words found in file into bank
 o main(String[])
default bank form: java -DDBANK= -DSBANK= -DMAXLEN= -DDLIST= WordBank
 o makeList()
put all words in bank in Vector
 o makeList(String)
put all words in bank that start with prefix in Vector
 o remove(String)
remove word from bank
 o save(String)
saves Trie tree as a DFS stream.
 o saveWords(String)
put all words in bank in ascii file
 o saveWords(String, String)
put all words in bank that starts with prefix in ascii file
 o size()
returns number of words in current bank

Constructors

 o WordBank
 public WordBank(int maxlen)
constructor: maxlen is maximum length a word may have to be allowed into the bank

 o WordBank
 public WordBank()

Methods

 o add
 public boolean add(String word)
add word to bank. If word has any special characters or numbers, it will not be added (unless the special character starts and/or ends the word i.e. "'fish'" (fishes.) alas, )

 o remove
 public void remove(String word)
remove word from bank

 o exists
 public boolean exists(String word)
returns true if word is in bank

 o makeList
 public Vector makeList(String prefix)
put all words in bank that start with prefix in Vector

 o makeList
 public Vector makeList()
put all words in bank in Vector

 o size
 public int size()
returns number of words in current bank

 o getMaxLength
 public int getMaxLength()
returns maximum allowed length of word in this instance of the WordBank object

 o getTree
 public WordTreeNode getTree()
returns Trie data structure that words are stored in

 o save
 public void save(String filename) throws IOException
saves Trie tree as a DFS stream. This is the most compact and the most effficient file format out of the three available for WordBank

 o load
 public synchronized void load(String filename) throws FileNotFoundException, IOException
 o saveWords
 public void saveWords(String prefix,
                       String filename) throws IOException
put all words in bank that starts with prefix in ascii file

 o saveWords
 public void saveWords(String filename) throws IOException
put all words in bank in ascii file

 o loadWords
 public void loadWords(String filename) throws FileNotFoundException, IOException
include all words found in file into bank

 o main
 public static void main(String argv[])
default bank form: java -DDBANK= -DSBANK= -DMAXLEN= -DDLIST= WordBank