java.lang.Object
de.grogra.task.Solver
- Direct Known Subclasses:
SolverInOwnThread
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voiddispose()This method is invoked by theTaskwhen this solver is removed from the task.final PartialTaskReturns the partial task which is currently solved by this solver.getTask()Returns the complete task for which this solver is used.voidinitialize(Task task) Initializes this solver to be used for the given task.protected abstract voidsolve()This method has to be implemented by subclasses in order to solve the current partial task synchronously or asynchronously.
-
Constructor Details
-
Solver
public Solver()
-
-
Method Details
-
initialize
Initializes this solver to be used for the given task.- Parameters:
task- the complete task for which this solver is used
-
getTask
Returns the complete task for which this solver is used.- Returns:
- complete task of this solver
-
getCurrentPartialTask
Returns the partial task which is currently solved by this solver. Returnsnullif the solver has nothing to do.- Returns:
- current partial task
-
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 methodTask.partialTaskDone(Solver)has to be invoked. -
dispose
public abstract void dispose()This method is invoked by theTaskwhen this solver is removed from the task. Subclasses have to implement this method in order to free resources (e.g., created threads).
-