|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface defines the agent functionality required by the Base. To be able to live on a Base, an object has to implements this interface.
An agent has a name. This name has to conform to the rule
that getType()
+"."+getJob()
+"." has to be a prefix
of getName()
.
The job name must be unique, ie two different jobs must
not use the same name. Of course, one job can contain many agents.
Method Summary | |
java.lang.String |
getJob()
Returns job name. |
java.lang.String |
getName()
Returns the name of the agent. |
java.lang.String |
getType()
Returns type identifier. |
boolean |
handleMessage(Message m,
java.lang.Object object)
Called when the agent has a new message. |
void |
onArrival(Address from,
Address to)
This is called when the agent is put into a base. |
void |
onDestruction()
This is called before the agent is destroyed by the base. |
void |
setBase(IBase b)
This is called by the base when the agent is received. |
int |
version()
Returns the version of the agent. |
Methods inherited from interface java.lang.Runnable |
run |
Method Detail |
public void onDestruction()
public void onArrival(Address from, Address to)
setBase(IBase)
method.from
- The address of the base from which the agent was sent.
If the agent has never been on any base it is null.to
- The address of the local base at the time of the arrival.
It is not guaranteed to remain valid trough the lifetime of the
agent. If the agent has never been on a base it is null.setBase(IBase)
public java.lang.String getName()
public java.lang.String getJob()
public java.lang.String getType()
public void setBase(IBase b)
b
- The Base that hosts the agent.public boolean handleMessage(Message m, java.lang.Object object)
m.setReply(Object)
in this method. The sender
of the message can read the reply through the IRequest interface
returned by fireMessage, via calling getInfo("reply")
.m
- The message to handle.object
- The object that is wrapped in the message. If null
then there is no binary content or it is not a serialized object
(in which case it can be read using Message.getBinary()
).Message.setReply(Object)
,
IBase.fireMessage(Message)
public int version()
Base.RELEASE_VERSION
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |