bill.apps.wordedit
Class AddWords

java.lang.Object
  |
  +--bill.apps.wordedit.AddWords

public class AddWords
extends Object

This class is used to control the adding of new words to the word list. It accepts input from stdin (typically the keyboard). If a word is at least three characters long it attempts to insert it into the word list. If the word already exists nothing happens, otherwise it is added to the list. If a word of two or fewer characters is entered, then the current word list is saved to a file.


Constructor Summary
AddWords()
          The default creator.
 
Method Summary
 void getWordsFromStdin()
          Gets words from stdin.
static void main(String[] args)
          Controls the running of the AddWords class.
 void populateWordList(String fileName)
          Controls the population of the class's word list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddWords

public AddWords()
The default creator. Sets class variables to default values.
Method Detail

populateWordList

public void populateWordList(String fileName)
                      throws Exception
Controls the population of the class's word list. This is done by creating the object which will hold the list and then calling a method to populate the object.
Parameters:
fileName - The name of the file that contains the word list
Returns:
true if the word list is successfully populated, false otherwise.

getWordsFromStdin

public void getWordsFromStdin()
Gets words from stdin. Reads a character at a time until an end of line or form feed is read, which signifies the end of a word. If the word is at least three characters long it is added to the word list.

main

public static void main(String[] args)
Controls the running of the AddWords class. Reads in the current word list, then calls getWordsFromStdin to allow the user to enter new words into the word list.