import java.net.*;import java.io.*;  public class WordEater {			URL u;	URLConnection uc;	StringBuffer grammarBuffer;	int grammarBufferPos=0;	boolean readComplete=false;	int	numCharacters=-1;		// For reading in the data.		public final static int spacer=1;	public final static int normal=2;	public final static int stopper=3;		public final static char equalityCharacter='=';	public final static char stoppingCharacter='/';	public final static char doubleStopCharacter=(char)(1);		// THis is sent out when a double slash is encountered.	public int[] scanTable=new int[256];		// This is a scan table used for parsing.					public void initializeScanHashTable(){ 		//The Scanning Hash Table has 256 entries. They identify a character as either, letter, stop character,}		//a space or a comment.}  	int i; 		for (i=14; i<=255; i++){ 			scanTable[i]=normal; 		} 		for (i=0; i<=13; i++){ 			scanTable[i]=spacer; 		}    		 scanTable[(byte)(equalityCharacter)] = stopper;  		  scanTable[(byte)(stoppingCharacter)]  = stopper;  		  scanTable[(byte)(' ')] = spacer; 	}		public  void openGrammarURL(String a, URL u){		// Takes a URL for a Grammar URL and reads it in line by line.		// We just 		String line;				if (a!="") {					try{						grammarBuffer = new StringBuffer();						grammarBufferPos = 0;						int pos=0;						int len;						u= new URL(u,a);						uc=u.openConnection();						DataInputStream theHTML = new DataInputStream(uc.getInputStream());						while ((line= theHTML.readLine()) != null) {								grammarBuffer.append(line);							}											grammarBuffer.append(' ');					} catch (MalformedURLException e) {						System.err.println(a+ " is a bad URL.");						System.err.println(e);					} catch (IOException e){ 						System.err.println("IO Error reading in the data.");					}				}		//	System.out.println("Hey, I found it.");		}					public NextWordResponse nextWord () {		String answer;			// What goes back. Null if eof.		answer = "";		boolean ds=false;				while ((grammarBufferPos<grammarBuffer.length()) && (scanTable[grammarBuffer.charAt(grammarBufferPos)]==spacer)){			grammarBufferPos++;		}				while ((grammarBufferPos<grammarBuffer.length()) && (scanTable[grammarBuffer.charAt(grammarBufferPos)]==normal)){			answer=answer+grammarBuffer.charAt(grammarBufferPos++);		}		answer=answer+" ";				//System.out.println("Found:"+answer+":");								if (grammarBufferPos>=grammarBuffer.length()){			return new NextWordResponse(answer,Globals.EndOfFileSignifier,false);		} else if (scanTable[grammarBuffer.charAt(grammarBufferPos)]==spacer) {			grammarBufferPos++;			return new NextWordResponse(answer,' ',false);		} else {			if ((scanTable[grammarBuffer.charAt(grammarBufferPos)]==stopper) &&			(scanTable[grammarBuffer.charAt(grammarBufferPos-1)]==stopper)) {				ds=true;			}			grammarBufferPos++;			return new NextWordResponse(answer,grammarBuffer.charAt(grammarBufferPos-1),ds);		}		 	}		}							