java.lang.Object
de.grogra.task.Solver
de.grogra.task.SolverInOwnThread
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
LocalSolver,NonGraphLockedSolver
This abstract class implements
Solver such that a thread
is created in which the actual work is done.- Author:
- Ole Kniemeyer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ThreadCreate the thread to use.voiddispose()This method is invoked by theTaskwhen this solver is removed from the task.voidrun()protected voidsolve()This method has to be implemented by subclasses in order to solve the current partial task synchronously or asynchronously.protected abstract voidsolveImpl(PartialTask task) This method has to be implemented to perform the actual work.Methods inherited from class de.grogra.task.Solver
getCurrentPartialTask, getTask, initialize
-
Constructor Details
-
SolverInOwnThread
public SolverInOwnThread()
-
-
Method Details
-
createThread
Create the thread to use. If this returnsnull, thesolvemethods operates synchronously, i.e., it immediately solves the partial task.- Returns:
- thread to use for operation, or
nullin synchronous case
-
solveImpl
This method has to be implemented to perform the actual work.- Parameters:
task- task to solve
-
solve
protected void solve()Description copied from class:SolverThis 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. -
run
public void run() -
dispose
public void dispose()Description copied from class:SolverThis 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).
-