|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjade.core.behaviours.Behaviour
jade.core.behaviours.ThreadedBehaviourFactory.ThreadedBehaviourWrapper
public class ThreadedBehaviourFactory.ThreadedBehaviourWrapper
Inner class ThreadedBehaviourWrapper This class is declared public for debugging purpose only
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class jade.core.behaviours.Behaviour |
|---|
Behaviour.RunnableChangedEvent |
| Field Summary |
|---|
| Fields inherited from class jade.core.behaviours.Behaviour |
|---|
myAgent, myEvent, NOTIFY_DOWN, NOTIFY_UP, parent, STATE_BLOCKED, STATE_READY, STATE_RUNNING |
| Method Summary | |
|---|---|
void |
action()
Runs the behaviour. |
boolean |
done()
Check if this behaviour is done. |
Behaviour |
getBehaviour()
|
DataStore |
getDataStore()
Return the private data store of this Behaviour. |
java.lang.Thread |
getThread()
|
java.lang.String |
getThreadState()
|
protected void |
handle(Behaviour.RunnableChangedEvent rce)
Propagate a DOWNWARDS event (typically this happens when this ThreadedBehaviourWrapper is added as a child of a CompositeBehaviour and the latter, or an ancestor, is blocked/restarted) to the wrapped threaded behaviour. |
int |
onEnd()
This method is just an empty placeholder for subclasses. |
void |
onStart()
This method is just an empty placeholders for subclasses. |
void |
reset()
Restores behaviour initial state. |
void |
restart()
Propagate a restart() call (typically this happens when this ThreadedBehaviourWrapped is directly added to the agent Scheduler and a message is received) to the wrapped threaded behaviour. |
void |
run()
|
void |
setDataStore(DataStore ds)
Set the private data store of this Behaviour |
protected void |
setParent(CompositeBehaviour parent)
Propagate the parent to the wrapped behaviour. |
| Methods inherited from class jade.core.behaviours.Behaviour |
|---|
actionWrapper, block, block, getBehaviourName, getExecutionState, getParent, getRestartCounter, handleBlockEvent, handleRestartEvent, isRunnable, root, setAgent, setBehaviourName, setExecutionState |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public void onStart()
BehaviourBehaviour.
onStart in class Behaviourpublic void action()
BehaviourBehavioursubclasses 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.
action in class BehaviourCompositeBehaviourpublic boolean done()
BehaviourBehaviour 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.
done in class Behaviourtrue if the behaviour has completely executed.public int onEnd()
BehaviourBehaviour.
onEnd is called after the behaviour has been
removed from the pool of behaviours to be executed by an agent.
Therefore calling
reset() is not sufficient to cyclically repeat the task
represented by this Behaviour. In order to achieve that,
this Behaviour must be added again to the agent
(using myAgent.addBehaviour(this)). The same applies to
in the case of a Behaviour that is a child of a
ParallelBehaviour.
onEnd in class Behaviourprotected void setParent(CompositeBehaviour parent)
parent member variable of the wrapped behaviour
must point to the DummyParentBehaviour --> From the wrapped behaviour
accessing the actual parent must always be retrieved through the
getParent() method.
public void setDataStore(DataStore ds)
BehaviourBehaviour
setDataStore in class Behaviourds - the DataStore that this Behaviour
will use as its private data storepublic DataStore getDataStore()
BehaviourBehaviour.
If it was null, a new DataStore is created and returned.
getDataStore in class BehaviourBehaviourpublic void reset()
Behaviourreset() on a behaviour object is equivalent to
destroying it and recreating it back. The main purpose for this
method is to realize multistep cyclic behaviours without needing
expensive constructions an deletion of objects at each loop
iteration.
Remind to call super.reset() from the sub-classes.
reset in class Behaviourpublic void restart()
restart in class BehaviourBehaviour.block()protected void handle(Behaviour.RunnableChangedEvent rce)
handle in class Behaviourrce - The event to handlepublic void run()
run in interface java.lang.Runnablepublic final java.lang.Thread getThread()
public final Behaviour getBehaviour()
public final java.lang.String getThreadState()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||