| Constructor and Description |
|---|
WakerBehavior(long millis)
Creates a behavior which is executed once after a specified delay.
|
WakerBehavior(long millis,
java.lang.Runnable runnable)
Creates a behavior which is executed once after a specified delay.
|
| Modifier and Type | Method and Description |
|---|---|
void |
action()
This method calls
onWake() when the specified delay for this
behavior expires. |
static WakerBehavior |
create(long millis,
java.lang.Runnable runnable)
Creates a new WakerBehavior which runs the specified Runnable once the specified delay expires.
|
boolean |
done()
Returns false until the delay expires, and true once the delay has
expired and the
onWake() method has been called. |
int |
getPriority()
This method should return a number that denotes the priority of a behavior.
|
long |
getWakeupTime()
Returns the wakeup time for this behavior.
|
void |
onStart()
Computes the wakeup time for this behavior.
|
void |
onWake()
This method is called once the specified delay for this behavior expires.
|
void |
reset()
Resets the behavior, allowing it to be used again.
|
void |
stop()
Terminates the behavior.
|
agent, agentForService, agentForService, agentsForService, agentsForService, block, block, compareTo, isBlocked, onEnd, println, restartpublic WakerBehavior(long millis)
millis - delay in milliseconds.public WakerBehavior(long millis,
java.lang.Runnable runnable)
millis - delay in milliseconds.runnable - Runnable to run.public final long getWakeupTime()
Platform.currentTimeMillis()public final void stop()
public void onWake()
public final void onStart()
onStart in class BehaviorBehavior.onStart()public final void action()
onWake() when the specified delay for this
behavior expires.action in class BehaviorBehavior.action()public final boolean done()
onWake() method has been called.done in class BehaviorBehavior.done()public void reset()
reset in class BehaviorBehavior.reset()public int getPriority()
BehaviorgetPriority in class Behaviorpublic static WakerBehavior create(long millis, java.lang.Runnable runnable)
millis - Delay in milliseconds.runnable - Runnable to run.