public class ParallelBehavior extends Object
run()
method of this behavior is called, all children that are
waiting for any of the current events are executed. This behavior always
waits for events that are specified by the Behavior.waitingFor()
methods of its children. The behavior is finished if all children are
finished.Constructor and Description |
---|
ParallelBehavior(BehaviorController controller)
Instantiates the behavior with the specified controller.
|
Modifier and Type | Method and Description |
---|---|
void |
addSubBehavior(Behavior subBehavior)
Add a sub-behavior to this composite behavior.
|
boolean |
isFinished()
Indicates whether the behavior is finished or requires re-scheduling.
|
void |
removeSubBehavior(Behavior subBehavior)
Remove a sub-behavior from this composite behavior.
|
Result |
result()
Returns the result of the behavior.
|
void |
run()
The implementation of the actual behavior.
|
EventPattern |
waitingFor()
Defines the event pattern for re-scheduling.
|
public ParallelBehavior(BehaviorController controller)
controller
- the controller of this behaviorpublic void run()
Behavior
public EventPattern waitingFor()
Defines the event pattern for re-scheduling. The behavior controller will re-schedule the behavior if an event occurs that is covered by the pattern.
The return value is computed from the children of this composite
behavior. The timeout
of the event pattern is the minimum
timeout of all children.
The contained message pattern is the universal
message pattern. When a message arrives, it is checked for every child
whether it awaits the message. This simplification is done for
performance reasons. It means that it suffices to iterate once over the
event patterns. The alternative would be to aggregate the message
patterns. However, then the patterns had to be evaluated multiple times,
once on every level of the behavior tree.
null
if the behavior is finishedpublic void addSubBehavior(Behavior subBehavior)
subBehavior
- the sub-behavior to be added.public void removeSubBehavior(Behavior subBehavior)
subBehavior
- the sub-behavior to be removed.public boolean isFinished()
Behavior
isFinished
in interface Behavior
true
if the behavior is finished,
false
otherwiseCopyright © Aimpulse Intelligent Systems GmbH
All rights reserved.