Module raytracer

Class Solver

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

public abstract class Solver extends 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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    This method is invoked by the Task when this solver is removed from the task.
    Returns the partial task which is currently solved by this solver.
    Returns the complete task for which this solver is used.
    void
    Initializes this solver to be used for the given task.
    protected abstract void
    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 Details

    • Solver

      public Solver()
  • Method Details

    • 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
    • getTask

      public Task getTask()
      Returns the complete task for which this solver is used.
      Returns:
      complete task of this solver
    • 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
    • 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.
    • 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).