|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectunsw.cse.mica.agent.DefaultAgent2
public abstract class DefaultAgent2
DefaultAgent2 is a utility class that inherits from the Agent class. It has implementations of:
The preferred agent name used for connection is determined by looking at for a value in the properties file whose parameter is the string specified by PARAM_NAME. If none is found the agent's java class name is used.
Field Summary | |
---|---|
static java.lang.String |
PARAM_NAME
|
Constructor Summary | |
---|---|
DefaultAgent2()
|
|
DefaultAgent2(boolean synchronizeTransport)
|
Method Summary | |
---|---|
AgentTransport |
getTransport()
Get the current agent transport. |
void |
handleDeletedMob(Mob m)
This method is called whenever a non-transient MICA object is deleted from the blackboard that the agent has registered interest it. |
void |
handleNewMob(Mob m)
This method is called when a new MICA object has arrived. |
void |
handleReplacedMob(Mob oldMob,
Mob newMob)
This method is called whenever a mob is replaced on the blackboard with a type for which the agent has registered interest. |
void |
handleTypeManagerChanged()
Called by the AgentTransport whenever the blackboard's type manager has changed. |
void |
init(MicaProperties args)
Connect using the value given for param "name" in the args if the value exists, otherwise use the class name |
boolean |
isATypeOf(Mob mob,
java.lang.String type)
Helper function to check types of mobs. |
void |
setTransport(AgentTransport at)
Set the agent transport. |
void |
terminate()
Terminate the agent. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PARAM_NAME
Constructor Detail |
---|
public DefaultAgent2()
public DefaultAgent2(boolean synchronizeTransport)
Method Detail |
---|
public void setTransport(AgentTransport at)
setTransport
in interface Agent
at
- The agent transport.public AgentTransport getTransport()
getTransport
in interface Agent
public void init(MicaProperties args) throws MicaException
args
- 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.
MicaException
public void terminate() throws MicaException
Agent
The agent should perform any necessary cleaning up in preparation for the process shutting down. This will generally mean doing the reverse of whatever occurred within the init method.
The usual contents of the terminate
method would be:
at.disconnect()
)
MicaException
public void handleNewMob(Mob m)
MessageHandler
Whenever a mob is written to the blackboard that the agent has registered
an interest in the handleNewMob
is called. It is passed the new Mob (MICA object)
as a parameter so it can decide any further actions.
Note: The handleNewMob is called asynchronously. You should not make any assumptions about its synchronizations.
handleNewMob
in interface MessageHandler
m
- the mob that has been written to the blackboardpublic void handleDeletedMob(Mob m)
MessageHandler
Whenever a mob is deleted from the blackboard that the agent has registered an interest in
the handleDeletedMob
method is called.
handleDeletedMob
in interface MessageHandler
m
- the mob that has been deletedpublic void handleReplacedMob(Mob oldMob, Mob newMob)
MessageHandler
handleReplacedMob
in interface MessageHandler
oldMob
- the old value of the mob (where the name is cleared)newMob
- the new value of the mobpublic void handleTypeManagerChanged()
MessageHandler
handleTypeManagerChanged
in interface MessageHandler
public boolean isATypeOf(Mob mob, java.lang.String type)
mob
- the mob being checkedtype
- the potential mob type
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |