public interface ActionEngine
Action
for execution. Work can be scheduled immediately or with
a given delay and can be periodic. This work can be tracked, cancelled and awaited.Modifier and Type | Method and Description |
---|---|
ActionBindings |
getBindings()
Bindings for this engine.
|
boolean |
isPaused()
Whether the engine is paused.
|
boolean |
isStopped()
Whether the engine is stopped.
|
<T> SchedulableActionContext<T> |
newContext(Action<T> action)
Creates an action context to define how the action will be scheduled for execution.
|
void |
pause()
Pauses action processing.
|
default <T> T |
putInBindings(java.lang.String key,
T value)
Puts a key-value pair in the engine bindings.
|
default <T> T |
removeFromBindings(java.lang.String key)
Removes a key-value pair from the engine bindings.
|
void |
resume()
Resumes performing actions.
|
default ActionContext<?> |
schedule(Action<?> action)
Schedules an action for immediate execution.
|
default <T> ActionContext<T> |
schedule(Action<T> action,
T actor)
Schedules an action referencing an actor for immediate execution.
|
void |
stop()
Permanently stops the engine.
|
ActionBindings getBindings()
boolean isPaused()
boolean isStopped()
<T> SchedulableActionContext<T> newContext(Action<T> action)
action
- Action to create context for.void pause()
default <T> T putInBindings(java.lang.String key, T value)
key
- Key.value
- Value.ActionBindings.put(String, Object)
default <T> T removeFromBindings(java.lang.String key)
key
- Key.ActionBindings.remove(String)
void resume()
default ActionContext<?> schedule(Action<?> action)
action
- Action to schedule.default <T> ActionContext<T> schedule(Action<T> action, T actor)
action
- Action to schedule.actor
- Actor to reference.void stop()