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
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Thread
Create the thread to use.void
dispose()
This method is invoked by theTask
when this solver is removed from the task.void
run()
protected void
solve()
This method has to be implemented by subclasses in order to solve the current partial task synchronously or asynchronously.protected abstract void
solveImpl
(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
, thesolve
methods operates synchronously, i.e., it immediately solves the partial task.- Returns:
- thread to use for operation, or
null
in 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:Solver
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. -
run
public void run() -
dispose
public void dispose()Description copied from class:Solver
This method is invoked by theTask
when this solver is removed from the task. Subclasses have to implement this method in order to free resources (e.g., created threads).
-