|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.subsumption.Arbitrator
public class Arbitrator
Arbitrator controls which behavior should become active in
a behavior control system. Make sure to call start() after the
Arbitrator is instantiated.
This class has three major responsibilities:
1. Determine the highest priority behavior that returns true to takeControl()
2. Suppress the active behavior if its priority is less than highest
priority.
3. When the action() method exits, it calls action() on the Behavior of highest priority.
This Behavior becomes active.
Chances since release 0.7:
1. It assumes that a Behavior is no longer active when action() exits.
2. Therefore it will only call suppress() on the Behavior whose action() method is running.
3. It can make consecutives calls of action() on the same Behavior.
4. Requirements for a Behavior:
When suppress() is called, terminate action() immediately.
Behavior
Constructor Summary | |
---|---|
Arbitrator(Behavior[] behaviorList)
Same as Arbitrator(behaviorList, false) Arbitrator start() never exits |
|
Arbitrator(Behavior[] behaviorList,
boolean returnWhenInactive)
Allocates an Arbitrator object and initializes it with an array of Behavior objects. |
Method Summary | |
---|---|
void |
start()
This method starts the arbitration of Behaviors and runs an endless loop. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Arbitrator(Behavior[] behaviorList, boolean returnWhenInactive)
behaviorList
- an array of Behavior objects.returnWhenInactive
- if true, the start() method returns when no Behavior is active.public Arbitrator(Behavior[] behaviorList)
behaviorList
- An array of Behavior objects.Method Detail |
---|
public void start()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |