// Processed by NMI's Java Code Viewer 4.8.2 © 1997-2000 B. Lemaire // Website: http://njcv.htmlplanet.com E-mail: info@njcv.htmlplanet.com // Copy registered to Evaluation Copy // Source File Name: Dictionary.java import java.applet.Applet; import java.io.*; import java.net.MalformedURLException; import java.net.URL; class Dictionary implements Runnable { public static final String fileName = "words.txt"; public static final int numWords = 45402; private String words[]; private Applet parentApplet; public Dictionary(Applet applet) { parentApplet = applet; } public void run() { words = new String[45402]; try { URL url = new URL(parentApplet.getCodeBase().toString() + "words.txt"); BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream())); int i = 0; String s; while((s = bufferedreader.readLine()) != null) { words[i++] = s.trim().toLowerCase(); Thread.currentThread(); Thread.yield(); } return; } catch(ArrayIndexOutOfBoundsException _ex) { return; } catch(MalformedURLException malformedurlexception) { malformedurlexception.printStackTrace(); return; } catch(IOException ioexception) { ioexception.printStackTrace(); } } public boolean containsWord(String s) { int i = 0; for(int j = words.length - 1; i <= j;) { int k = (j - i) / 2 + i; int l = s.compareTo(words[k]); if(l < 0) j = k - 1; else if(l > 0) i = k + 1; else return true; } return false; } }