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, restart
public 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 Behavior
Behavior.onStart()
public final void action()
onWake()
when the specified delay for this
behavior expires.action
in class Behavior
Behavior.action()
public final boolean done()
onWake()
method has been called.done
in class Behavior
Behavior.done()
public void reset()
reset
in class Behavior
Behavior.reset()
public int getPriority()
Behavior
getPriority
in class Behavior
public static WakerBehavior create(long millis, java.lang.Runnable runnable)
millis
- Delay in milliseconds.runnable
- Runnable to run.