public class Future<T>
extends java.lang.Object
This class handles future results from actor routines.
This class follows DbC(tm) methodology
(Wikipedia).
Where possible, contracts are implement with native's Java
assert.
Constructor and Description |
---|
Future(boolean isFunction)
Constructs a new future (either for a function or a procedure).
|
Modifier and Type | Method and Description |
---|---|
void |
done()
Waits until the actor's routine attached to this future is done.
|
boolean |
isFunction()
Is this future applied to a function?
|
T |
result()
The result of the actor's function attached to this future.
|
void |
setResult(T res)
Sets the result of the actor's function attached to this future.
|
public Future(boolean isFunction)
isFunction
- true if is a function future (with a result), or false for a procedurepublic boolean isFunction()
boolean
true if is a function future, otherwise it is a procedure futurepublic void done()
public T result()
requires: isFunction()
T
the function's resultpublic void setResult(T res)
requires: isFunction()
res
- the function's result