// Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   Dictionary.java

import java.io.*;
import java.net.URL;
import java.util.Iterator;
import java.util.TreeSet;

public class Dictionary extends TreeSet
{

    Dictionary()
        throws IOException
    {
        URL url = getClass().getResource("words");
        if(url == null)
        {
            System.err.println("Dictionary is not in jar!");
            System.exit(0);
        }
        BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream()));
        String s;
        do
        {
            s = bufferedreader.readLine();
            if(s != null && !add(s.toLowerCase()))
                System.err.println("Warning: Duplicate word detected '" + s + "'");
        } while(s != null);
        bufferedreader.close();
    }

    public boolean contains(String s)
    {
        return super.contains(s.toLowerCase());
    }

    public static void main(String args[])
    {
        Dictionary dictionary;
        try
        {
            dictionary = new Dictionary();
        }
        catch(IOException ioexception)
        {
            System.out.println("Failed to make dictionary object");
            System.out.println(ioexception);
            return;
        }
        Iterator iterator = dictionary.iterator();
        System.out.println("Dictionary dump");
        for(; iterator.hasNext(); System.out.println(iterator.next()));
        System.out.println();
        System.out.print(dictionary.size());
        System.out.println(" elements.");
    }

    static final String dictionaryFile = "words";
}

