public class SequentialBehaviour extends SerialBehaviour
CompositeBehaviour that executes its children behaviours
in sequential order, and terminates when its last child has ended.| Constructor and Description |
|---|
SequentialBehaviour()
Default constructor.
|
SequentialBehaviour(Agent a)
This constructor sets the owner agent for this behaviour.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSubBehaviour(Behaviour b)
Add a sub behaviour to this
SequentialBehaviour |
protected boolean |
checkTermination(boolean currentDone,
int currentResult)
Check whether this
SequentialBehaviour must terminate. |
Collection |
getChildren()
Return a Collection view of the children of
this
SequentialBehaviour |
protected Behaviour |
getCurrent()
Get the current child
|
void |
removeSubBehaviour(Behaviour b)
Remove a sub behaviour from this
SequentialBehaviour |
void |
reset()
Puts a
CompositeBehaviour back in initial state. |
protected void |
scheduleFirst()
Prepare the first child for execution
|
protected void |
scheduleNext(boolean currentDone,
int currentResult)
Sequential policy for children scheduling.
|
action, done, resetChildren, setAgentblock, block, getAgent, getBehaviourName, getDataStore, getParent, isRunnable, onEnd, onStart, restart, root, setBehaviourName, setDataStorepublic SequentialBehaviour()
public SequentialBehaviour(Agent a)
a - The agent this behaviour belongs to.protected void scheduleFirst()
scheduleFirst in class CompositeBehaviourCompositeBehaviour.scheduleFirst()protected void scheduleNext(boolean currentDone,
int currentResult)
scheduleNext in class CompositeBehaviourcurrentDone - a flag indicating whether the just executed
child has completed or not.currentResult - the termination value (as returned by
onEnd()) of the just executed child in the case this
child has completed (otherwise this parameter is meaningless)CompositeBehaviour.scheduleNext(boolean, int)protected boolean checkTermination(boolean currentDone,
int currentResult)
SequentialBehaviour must terminate.checkTermination in class CompositeBehaviourcurrentDone - a flag indicating whether the just executed
child has completed or not.currentResult - the termination value (as returned by
onEnd()) of the just executed child in the case this
child has completed (otherwise this parameter is meaningless)CompositeBehaviour.checkTermination(boolean, int)protected Behaviour getCurrent()
getCurrent in class CompositeBehaviourCompositeBehaviour.getCurrent()public Collection getChildren()
SequentialBehaviourgetChildren in class CompositeBehaviourCompositeBehaviour.getChildren()public void addSubBehaviour(Behaviour b)
SequentialBehaviourpublic void removeSubBehaviour(Behaviour b)
SequentialBehaviourpublic void reset()
CompositeBehaviourCompositeBehaviour back in initial state. The
internal state is cleaned up and reset() is
recursively called for each child behaviour.reset in class CompositeBehaviour