public class ComponentActionList
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ComponentActionList.ActionEntry
Entry for a scheduled action.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.Set<ComponentActionList.ActionEntry> |
actions
The scheduled actions.
|
protected ICommand |
cmd
The schedule command.
|
protected java.util.Collection<ComponentActionList.ActionEntry> |
executed
The executed actions where actors still need to be woken up.
|
protected IEnvironmentSpace |
space
The environment space.
|
Constructor and Description |
---|
ComponentActionList(IEnvironmentSpace space)
Create a new action list.
|
Modifier and Type | Method and Description |
---|---|
void |
addComponentAction(ComponentActionList.ActionEntry entry)
Add an component action.
|
void |
cancelComponentAction(int id)
Cancels a component action.
|
void |
executeActions(IFilter filter,
boolean wakeup)
Should be called on environment thread only.
|
ComponentActionList.ActionEntry[] |
getActionEntries()
Get the queued entries, which have not yet been executed.
|
void |
removeComponentAction(ComponentActionList.ActionEntry entry)
Remove an component action.
|
int |
scheduleComponentAction(ISpaceAction action,
java.util.Map parameters,
IResultListener listener)
Schedules an component action.
|
void |
setOrdering(java.util.Comparator comp)
Set an ordering used for executing actions.
|
void |
setScheduleCommand(ICommand cmd)
Set the schedule command to be invoked, when an action should be scheduled.
|
void |
wakeupComponents(IFilter filter)
Should be called on environment thread only.
|
protected IEnvironmentSpace space
protected java.util.Set<ComponentActionList.ActionEntry> actions
protected java.util.Collection<ComponentActionList.ActionEntry> executed
protected ICommand cmd
public ComponentActionList(IEnvironmentSpace space)
public int scheduleComponentAction(ISpaceAction action, java.util.Map parameters, IResultListener listener)
action
- The action.parameters
- parameters for the action (may be null)listener
- the result listenerpublic void cancelComponentAction(int id)
public void addComponentAction(ComponentActionList.ActionEntry entry)
entry
- The action entry.public void removeComponentAction(ComponentActionList.ActionEntry entry)
entry
- The action entry.public ComponentActionList.ActionEntry[] getActionEntries()
public void setOrdering(java.util.Comparator comp)
comp
- The comparator representing the ordering.public void executeActions(IFilter filter, boolean wakeup)
filter
- A filter to select only a subset of actions (or null for all actions).wakeup
- Immediately wake up each calling component after its action has been executed
(otherwise wakeupComponents() has to be called separately).public void wakeupComponents(IFilter filter)
filter
- A filter to select only a subset of actions (or null for all actions).
(otherwise wakeupComponents() has to be called separately).public void setScheduleCommand(ICommand cmd)