Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.grogra.task
Class Task

    java.lang.Object
      de.grogra.task.Task

Direct Known Subclasses:
  ConcurrentTasks, PixelwiseRenderer

    public abstract class Task

extends java.lang.Object

A `Task` is used for a complex problem which can be decomposed in several independent `PartialTask`s. These partial tasks are solved synchronously or asynchronously by a set of `Solver`s which may work in different threads or even on remote computers.

Author:
  Ole Kniemeyer

Constructor Summary
`Task()`

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Task

    public Task()

Method Detail

### addSolver

    public void addSolver(Solver s)

  Adds a solver to this task.

  Parameters:
    `s` - a solver

### dispose

    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. Note that the solver may not have completely processed its partial task.

  Parameters:
    `task` - partial task which is no longer processed

### done

    protected abstract boolean done()

  Returns `true` iff the complete task has been solved.

  Returns:
    has the task been solved?

### finishSolve

    protected void finishSolve()

### getSolverCount

    public int getSolverCount()

  Returns the number of solvers for this task.

  Returns:
    number of solvers

### getSolvers

    public Solver[] getSolvers()

### isSolving

    public boolean isSolving()

### isStopped

    public boolean isStopped()

  This method returns `true` iff the method `stop()` has been invoked on this task.

  Returns:
    has this task been stopped?

### nextPartialTask

    protected abstract PartialTask nextPartialTask(int solverIndex)

  This method returns the next partial task for this task. If all parts of the task have been solved or currently are being solved, `null` is returned. However, a later invocation may return a partial task if a currently active solver does not completely solve its partial task.

  Parameters:
    `solverIndex` - index of solver which will be used for next task
  Returns:
    next partial task, or `null`

### partialTaskDone

    public void partialTaskDone(Solver s)

  This method has to be invoked by a solver if it has completed processing its current partial task. Note that (depending on the specific implementation of `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)`.

  Parameters:
    `s` - the solver which has completed processing its partial task

### prepareSolve

    protected void prepareSolve()

### removeSolver

    public void removeSolver(Solver s)

  Removes a solver from this task. The method `Solver.dispose()` is invoked on `s`.

  Parameters:
    `s` - a solver

### removeSolvers

    public void removeSolvers()

### solve

    public void solve()

### stop

    public void stop()

  This method is invoked in order to stop the computation of this task.

Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD