public class SimpleArbitrator extends java.lang.Object implements Arbitrator
Constructor and Description |
---|
SimpleArbitrator()
Creates a simple arbitrator with
the default monitor delay
|
SimpleArbitrator(int monitorDelay)
Creates a simple arbitrator with
a custom monitor delay
|
Modifier and Type | Method and Description |
---|---|
void |
addBehavior(Behavior behavior)
Add a behavior to the arbitration process
|
void |
addBehavior(Behavior behavior,
int priority)
Add a behavior with a defined priority to the arbitrator process
|
void |
immediateClaim()
Immediately trigger an arbitration between the behaviors
|
void |
removeBehavior(Behavior behavior)
Removes a behavior from the arbitrator process
|
void |
start()
Starts the arbitration process
|
void |
stop()
Stops the arbitration process
|
public SimpleArbitrator()
public SimpleArbitrator(int monitorDelay)
monitorDelay
- the monitor delay to use in millisecondspublic void start()
Arbitrator
start
in interface Arbitrator
public void stop()
Arbitrator
stop
in interface Arbitrator
public void immediateClaim()
Arbitrator
immediateClaim
in interface Arbitrator
public void addBehavior(Behavior behavior)
behavior
- the behavior to be addedpublic void addBehavior(Behavior behavior, int priority)
behavior
- the behavior to be addedpriority
- the priority of the behavior
(overrides the priority defined by the behavior implementation)public void removeBehavior(Behavior behavior)
behavior
- the behavior to be removed.