import java.io.*;
import java.net.*;

/****************************************************************************
* This class is only used by ComputerAdvice in the JESS emulation mode.  Since
* that mode is only used for testing purposes, this class will not be 
* documented.
*
* @author Michael Wales <a href="http://www.mwales.net">Homepage</a>
****************************************************************************/
public class JESSReader implements Runnable
{
   private Socket JessConnection;
   
   /*************************************************************************
   * 
   *************************************************************************/
   public JESSReader(Socket Connection)
   {
      JessConnection = Connection;
   }
   
   /*************************************************************************
   * 
   *************************************************************************/
   public void run()
   {
      InputStream JessIS = null;
      BufferedReader JessBR = null;
      
      try
      {
         JessIS = JessConnection.getInputStream();
         JessBR = new BufferedReader( new InputStreamReader( JessIS ) );
      }
      catch(Exception E)
      {
         System.out.println("ERROR:  Failed to initialize the Jess socket reader");
         return;
      }
      
      while (true)
      {
         try
         {
            System.out.println( JessBR.readLine() );
         }
         catch(Exception E)
         {
            System.out.println("ERROR:  Failed to read incoming data from the socket");
            return;
         }
      }      
   }
   
   

}