de.grogra.task
public abstract class Task extends java.lang.Object
Task is used for a complex problem which can be decomposed
in several independent PartialTasks. These
partial tasks are solved synchronously or asynchronously by a set of
Solvers which may work in different threads or even
on remote computers.| Constructor and Description |
|---|
Task() |
| Modifier and Type | Method and Description |
|---|---|
void |
addSolver(Solver s)
Adds a solver to this task.
|
protected abstract void |
dispose(PartialTask task)
This method is invoked when an active solver is removed or
invokes
partialTaskDone(Solver) in order to tell this
task that the partial task of the solver is no longer processed. |
protected abstract boolean |
done()
Returns
true iff the complete task has been solved. |
protected void |
finishSolve() |
int |
getSolverCount()
Returns the number of solvers for this task.
|
Solver[] |
getSolvers() |
boolean |
isSolving() |
boolean |
isStopped()
This method returns
true iff the method
stop() has been invoked on this task. |
protected abstract PartialTask |
nextPartialTask(int solverIndex)
This method returns the next partial task for this task.
|
void |
partialTaskDone(Solver s)
This method has to be invoked by a solver if it has
completed processing its current partial task.
|
protected void |
prepareSolve() |
void |
removeSolver(Solver s)
Removes a solver from this task.
|
void |
removeSolvers() |
void |
solve() |
void |
stop()
This method is invoked in order to stop the computation
of this task.
|
public void addSolver(Solver s)
s - a solverprotected abstract void dispose(PartialTask task)
partialTaskDone(Solver) in order to tell this
task that the partial task of the solver is no longer processed.
Note that the solver may not have completely processed
its partial task.task - partial task which is no longer processedprotected abstract boolean done()
true iff the complete task has been solved.protected void finishSolve()
public int getSolverCount()
public Solver[] getSolvers()
public boolean isSolving()
public boolean isStopped()
true iff the method
stop() has been invoked on this task.protected abstract PartialTask nextPartialTask(int solverIndex)
null is returned. However, a later invocation
may return a partial task if a currently active solver
does not completely solve its partial task.solverIndex - index of solver which will be used for next tasknullpublic void partialTaskDone(Solver s)
Task)
a solver may complete processing its partial task without
completely solving it. In this case the unsolved part of the
partial task is returned as part of later invocations
of nextPartialTask(int).s - the solver which has completed processing its partial taskprotected void prepareSolve()
public void removeSolver(Solver s)
Solver.dispose()
is invoked on s.s - a solverpublic void removeSolvers()
public void solve()
public void stop()