@@ -0,0 +1,1203 @@
+package Main;%0Aimport java.net.*;%0Aimport java.io.*;%0A%0A/* %0A          Enhanced and optimized for Moodfinder application by Amin Amini Maghsoud Bigy: 2012%0A          */%0Apublic class Instance extends Thread %7B%0A  // Variable declarations%0A  private Socket socket = null;%0A  //Constructor method%0A  //The syntax used here can be confusing%0A  public Instance(Socket socket) %7B%0A    super(%22Instance%22);%0A    this.socket = socket;%0A  %7D%0A  public void run() %7B%0A    try %7B%0A      System.out.println(%22Initialising thread IO connections and state object%22);%0A      PrintWriter out = new PrintWriter(socket.getOutputStream(), true);%0A      BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));%0A      String inputLine, outputLine;%0A      Moodfinder mood = new Moodfinder();%0A      outputLine = mood.processInput(null);%0A      out.println(outputLine);%0A      while ((inputLine = in.readLine()) != null) %7B%0A        outputLine = mood.processInput(inputLine);%0A        out.println(outputLine);%0A        if (outputLine.equals(%22document printed successfully%22))%0A          break;%0A      %7D%0A       out.close();%0A       in.close();%0A       socket.close();%0A    %7D catch (IOException e) %7B%0A      e.printStackTrace();%0A    %7D%0A  %7D%0A%7D%0A

Create Instance.java