R
- the type of computation resultpublic abstract class ComputationAction<R> extends Object implements Action
ComputationAction
class is extended by classes which compute some kind of
result R
. After the computation stops the result can be retrieved.ComputationEvent
,
ComputationListener
Modifier and Type | Method and Description |
---|---|
void |
addComputationListener(ComputationListener l)
Adds the Computation Listener
l to this action. |
abstract void |
cancelComputation()
Cancels the computation started by execution of this
ComputationAction . |
long |
getElapsedTime()
Returns the time (in seconds) which were needed for the computation.
|
abstract R |
getResult()
Returns the result of the computation.
|
void |
removeComputationListener(ComputationListener l)
Removes the Computation Listener
l from this action. |
public abstract R getResult()
public void addComputationListener(ComputationListener l)
l
to this action.l
- the listener to receive computation eventspublic void removeComputationListener(ComputationListener l)
l
from this action.l
- the listener to be removedpublic long getElapsedTime()
public abstract void cancelComputation() throws IllegalStateException
ComputationAction
.IllegalStateException
- thrown if this method is invoked before the
execute
-method has been invokedAction.execute()