/* Eval.java: This is an example of an eval function for a very simple master/worker parallel program. It simply ins a task (integer value), computes the square of the integer and outs this as a result. Although it is simple, it clearly demonstrates the basic structure of master/worker parallel programs in Java-Linda. The TestEval class below contains the interesting application specific code. */ package EDU.Yale.CS.TupleSpace; import java.io.*; import java.net.*; import LennyT.*; final class TestEval extends Eval { public void run() { try { System.out.println("TestEval loaded"); if (theTupleSpace == null) { System.err.println("I have no TupleSpace!!!"); System.err.flush(); } else { System.out.println("We have a valid(?) TupleSpace"); System.out.println("About to in()..."); Task aks_tmp = (Task) theTupleSpace.in(new Task(0)); System.out.println("in()ed!"); int out_res = (aks_tmp.task_int) * (aks_tmp.task_int); theTupleSpace.out(new Result(out_res)); } } catch (IOException e) { System.err.println("TestEval: caught exception:\t" + e); } catch (ClassNotFoundException e) { System.err.println("TestEval: caught exception:\t" + e); } } }