|
Nested classes/interfaces inherited from class sajas.core.behaviours.Behaviour |
Behaviour.RunnableChangedEvent |
Fields inherited from class sajas.core.behaviours.Behaviour |
myAgent, myEvent, NOTIFY_DOWN, NOTIFY_UP, parent, STATE_BLOCKED, STATE_READY, STATE_RUNNING |
Constructor Summary | ||
TickerBehaviour(Agent a, long period) Construct a TickerBehaviour that call its onTick() method every period ms. |
Method Summary | ||
void |
action() Runs the behaviour. |
|
boolean |
done() Check if this behaviour is done. |
|
protected long |
getPeriod() | |
int |
getTickCount() Retrieve how many ticks were done (i.e. |
|
void |
onStart() This method is just an empty placeholders for subclasses. |
|
protected abstract void |
onTick() This method is invoked periodically with the period defined in the constructor. |
|
void |
reset() This method must be called to reset the behaviour and starts again |
|
void |
reset(long period) This method must be called to reset the behaviour and starts again |
|
void |
setFixedPeriod(boolean fixedPeriod) Turn on/off the "fixed period" mode. |
|
void |
stop() Make this TickerBehaviour terminate. |
Methods inherited from class sajas.core.behaviours.Behaviour |
actionWrapper, block, block, getAgent, getBehaviourName, getDataStore, getExecutionState, getParent, getRestartCounter, handle, handleBlockEvent, handleRestartEvent, isRunnable, onEnd, restart, root, setAgent, setBehaviourName, setDataStore, setExecutionState |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TickerBehaviour
that call its
onTick()
method every period
ms.Behaviour
.Behaviour
subclasses to perform ordinary behaviour
duty. An agent schedules its behaviours calling their
action()
method; since all the behaviours belonging
to the same agent are scheduled cooperatively, this method
must not enter in an endless loop and should return as
soon as possible to preserve agent responsiveness. To split a
long and slow task into smaller section, recursive behaviour
aggregation may be used.Behaviour
still need to be
run or it has completed its task. Concrete behaviours must
implement this method to return their completion state. Finished
behaviours are removed from the scheduling queue, while others
are kept within to be run again when their turn comes again.true
if the behaviour has completely executed.TickerBehaviour
terminate.
Calling stop() has the same effect as removing this TickerBehaviour, but is Thread safe
|