|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectunsw.cse.mica.agent.DefaultAgent2
unsw.cse.mica.tools.timer.TimerAgent
public class TimerAgent
TimerAgent is a wrapper around a Timer, allowing for both
one-off and repeated events to be generated. Events are added using
"timerRequest" mobs or cancelled using "timerCancel" mobs.
Event name and type
Timer events must be given a name via the eventName slot. This is used by
the agent to track events in order to allow subsequent event cancellation.
Furthermore, the name is given as a preferred name for the resulting mob
event.
A timerRequest may also contain an eventType slot. If present, this
value specifies the type of Mob that will be generated. If it is not present, the
timerEvent type is used.
Specifying event timing
Each mob should contain one of:
If neither of these is found, the agent assumes an implicit relativeTime of
zero, resulting in an event that will fire immediately.
To specify a recurring event, the follow slots are used:
| Field Summary |
|---|
| Fields inherited from class unsw.cse.mica.agent.DefaultAgent2 |
|---|
PARAM_NAME |
| Constructor Summary | |
|---|---|
TimerAgent()
Create a new TimerAgent |
|
| Method Summary | |
|---|---|
void |
fire(TimerEvent event)
Fire an event. |
void |
handleNewMob(Mob mob)
Handle incomnig Mobs. |
void |
init(MicaProperties args)
Initialise the TimerAgent, by connectnig to the blackboard, registering for timerRequest and timerCancel events, and starting the internal Timer. |
void |
terminate()
Terminate the agent. |
| Methods inherited from class unsw.cse.mica.agent.DefaultAgent2 |
|---|
getTransport, handleDeletedMob, handleReplacedMob, handleTypeManagerChanged, isATypeOf, setTransport |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TimerAgent()
| Method Detail |
|---|
public void init(MicaProperties args)
throws MicaException
init in interface Agentinit in class DefaultAgent2args - Additional arguments provided to the agent. If the agent is started from with
the 'Runner' tool, the args array contains the values provided from within the runner's
XML configuration file. Otherwise, the exact contents will depend on the calling method.
MicaExceptionpublic void terminate()
terminate in interface Agentterminate in class DefaultAgent2public void handleNewMob(Mob mob)
handleNewMob in interface MessageHandlerhandleNewMob in class DefaultAgent2mob - the mob that has been written to the blackboardpublic void fire(TimerEvent event)
fire in interface ITimerHandler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||