Methods Summary |
---|
public int | getIterations()
return numIterations;
|
public RMIProblemSet | getProblem()
return currProblem;
|
public static void | main(java.lang.String[] argv)
try {
// Register an instance of RMISolverImpl with the
// RMI Naming service
String name = "TheSolver";
System.out.println("Registering RMISolverImpl as \""
+ name + "\"");
RMISolverImpl solver = new RMISolverImpl();
Naming.rebind(name, solver);
System.out.println("Remote Solver ready...");
}
catch (Exception e) {
System.out.println("Caught exception while registering: "
+ e);
}
|
public boolean | setIterations(int numIter)
numIterations = numIter;
return true;
|
public boolean | setProblem(RMIProblemSet s)
currProblem = s;
return true;
|
public boolean | solve()
System.out.println("Solving current problem...");
return solve(currProblem, numIterations);
|
public boolean | solve(RMIProblemSet s, int numIters)
boolean success = true;
if (s == null) {
System.out.println("No problem to solve.");
return false;
}
System.out.println("Problem value = " + s.getValue());
// Solve problem here...
try {
s.setSolution(Math.sqrt(s.getValue()));
}
catch (ArithmeticException e) {
System.out.println("Badly-formed problem.");
success = false;
}
System.out.println("Problem solution = " + s.getSolution());
return success;
|