import java.io.*;
import java.util.*;

public class Dictionary {
    private Vector words;
    
    public Dictionary(String name) {
		words = new Vector();
		try {
			FileInputStream stream = new FileInputStream(name);
			InputStreamReader reader = new InputStreamReader(stream);
			BufferedReader buffer = new BufferedReader(reader);
			String word = buffer.readLine();
			while (word != null) {
				words.addElement(word);
				word = buffer.readLine();
			}
			stream.close();
		} catch (IOException e) { 
			System.out.println("Bad file\n");
			System.out.println("Using empty word list\n");
		}
    }
	
    public boolean lookup (String word) {
		for (int i = 0; i < words.size(); i++) {
			String w = (String)words.elementAt(i);
			if (word.equals(w))
				return true;
		}
		return false;
    }
}

