PARAMETER
- Parameter typeRESULT
- Result typePROGRESS
- Progression typepublic abstract class ThreadedTask<PARAMETER,RESULT,PROGRESS>
extends java.lang.Object
ThreadManager
.ThreadManager
.Parameter | It is given when this task turn arrive (One time or by repetition) | It allows to have only one instance that react to different parameters in different threads |
---|---|---|
Result | It is is computed by the implementation of the derived class. | When the result is computed this class is alerted. |
Progress | During the computing, you can signal a progression to for example update a progress bar | The progression information is up to implementation and it signal in separate thread, so when received the progression information it is not the exact progression. We have do this choice to not slow down the computation by showing progression |
Modifier and Type | Field and Description |
---|---|
private PostProgress<PROGRESS> |
postProgress
For post a progression
|
Constructor and Description |
---|
ThreadedTask()
Create a new instance of ThreadedTask
|
Modifier and Type | Method and Description |
---|---|
protected void |
cancel()
Request to cancel the task
|
protected void |
canceled()
It is call when a cancel is requested.
|
protected void |
doProgress(PROGRESS progress)
It is call when a progression information arrive.
|
protected abstract RESULT |
doThreadAction(PARAMETER parameter)
Call when the turn of this thread comes.
|
protected void |
postProgress(PROGRESS progress)
Call this method to post a progression during the computing
|
protected void |
setResult(RESULT result)
Call when task is finish.
|
private PostProgress<PROGRESS> postProgress
protected final void cancel()
protected void canceled()
protected void doProgress(PROGRESS progress)
progress
- Progression informationprotected abstract RESULT doThreadAction(PARAMETER parameter)
parameter
- Parameter to useprotected final void postProgress(PROGRESS progress)
progress
- Progression information to postprotected void setResult(RESULT result)
result
- Computed result