T
- the type the observed ObservableValue
's wrapspublic class ExecuteOnceWhen<T> extends Object
ObservableValue
's value fulfills a certain condition.
The action will not be executed before executeWhen()
is called. The action is only executed once. If it was
not yet executed, this can be prevented by calling cancel()
.
This class guarantees that regardless of the way different threads interact with the ObservableValue
the
action will be executed...
executeWhen()
returns passes the condition
executeWhen()
or after it returns)
executeWhen()
) or one of several which were set by those threads.
Use ExecuteWhen
to build an instance of this class.
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels the future execution of the action.
|
void |
executeWhen()
Executes the action (once) when the observable's value passes the condition.
|
public void executeWhen() throws IllegalStateException
This is a one way function that must only be called once. Calling it again throws an
IllegalStateException
.
Call cancel()
to prevent future execution.
IllegalStateException
- if this method is called more than oncepublic void cancel()
executeWhen()
was not yet called or the action was
already executed, this is a no-op.This documentation is licensed under CC-BY 4.0, attributed to Nicolai Parlog from CodeFX.