de.grogra.task
Class Solver

java.lang.Object
  extended by de.grogra.task.Solver
Direct Known Subclasses:
SolverInOwnThread

public abstract class Solver
extends java.lang.Object

A Solver solves a PartialTask of a Task. The process of solving may be implemented asynchronously, so that multiple processors or even remote processors can be used.

Author:
Ole Kniemeyer

Constructor Summary
Solver()
           
 
Method Summary
abstract  void dispose()
          This method is invoked by the Task when this solver is removed from the task.
 PartialTask getCurrentPartialTask()
          Returns the partial task which is currently solved by this solver.
 Task getTask()
          Returns the complete task for which this solver is used.
 void initialize(Task task)
          Initializes this solver to be used for the given task.
protected abstract  void solve()
          This method has to be implemented by subclasses in order to solve the current partial task synchronously or asynchronously.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Solver

public Solver()
Method Detail

dispose

public abstract void dispose()
This method is invoked by the Task when this solver is removed from the task. Subclasses have to implement this method in order to free resources (e.g., created threads).


getCurrentPartialTask

public final PartialTask getCurrentPartialTask()
Returns the partial task which is currently solved by this solver. Returns null if the solver has nothing to do.

Returns:
current partial task

getTask

public Task getTask()
Returns the complete task for which this solver is used.

Returns:
complete task of this solver

initialize

public void initialize(Task task)
Initializes this solver to be used for the given task.

Parameters:
task - the complete task for which this solver is used

solve

protected abstract void solve()
This method has to be implemented by subclasses in order to solve the current partial task synchronously or asynchronously. After the partial task has been solved, the method Task.partialTaskDone(Solver) has to be invoked.