jade.core.behaviours
Class WakerBehaviour
java.lang.Object
|
+--jade.core.behaviours.Behaviour
|
+--jade.core.behaviours.SimpleBehaviour
|
+--jade.core.behaviours.WakerBehaviour
- public abstract class WakerBehaviour
- extends SimpleBehaviour
This abstract class implements a OneShot task that must be executed
only one just after a given timeout is elapsed.
The task is simply the call to the method
handleElapsedTimeout() that must be implemented by
all subclasses. Notice that the best practice in JADE is when
this method just adds a behaviour to the agent class.
All subclasses have available the protected variable
myAgent that points to the agent class.
The programmer must use this abstract class in this simple way:
- implements a subclass that extends WakerBehaviour. This subclass
must implement the method
handleElapsedTimeout.
- add the subclass to the list of behaviour of this agent by using
addBehaviour() method.
- the method
handleElapsedTimeout must implement the
task that will be executed after the timeout is elapsed.
- Author:
- Fabio Bellifemine - CSELT S.p.A.
- See Also:
- Serialized Form
|
Method Summary |
void |
action()
|
boolean |
done()
|
protected abstract void |
handleElapsedTimeout()
This method is called by this subclass only after the given timeout is
elapsed. |
protected void |
reset(java.util.Date wakeupDate)
This method must be called to reset the behaviour and starts again |
protected void |
reset(long timeout)
This method must be called to reset the behaviour and starts again |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
WakerBehaviour
public WakerBehaviour(Agent a,
java.util.Date wakeupDate)
- This method constructs the behaviour.
- Parameters:
a - is the pointer to the agentwakeupDate - is the date when the task must be executed
WakerBehaviour
public WakerBehaviour(Agent a,
long timeout)
- This method constructs the behaviour.
- Parameters:
a - is the pointer to the agenttimeout - indicates the number of milliseconds after which the
task must be executed
action
public void action()
- Overrides:
- action in class Behaviour
handleElapsedTimeout
protected abstract void handleElapsedTimeout()
- This method is called by this subclass only after the given timeout is
elapsed.
The method has available the class variable
myAgent that
points to the agent class.
reset
protected void reset(java.util.Date wakeupDate)
- This method must be called to reset the behaviour and starts again
- Parameters:
wakeupDate - is the new time when the task must be executed again
reset
protected void reset(long timeout)
- This method must be called to reset the behaviour and starts again
- Parameters:
wakeupDate - is the new time when the task must be executed again
done
public boolean done()
- Overrides:
- done in class Behaviour