|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.kaariboga.core.Kaariboga
The Kaariboga class implements the base class of a mobile agent. It is able to jump from host to host and runs there in it's own thread. Each kaariboga needs a KaaribogaBase object that handles it's requests and sends and receives it.
Inner Class Summary | |
(package private) class |
Kaariboga.FireEventThread
Fires kaariboga events to the kaaribogaListener. |
(package private) class |
Kaariboga.FireMessageThread
Fires KaaribogaMessage to the kaaribogaMessageListener. |
Field Summary | |
protected KaaribogaBase |
base
The base is the KaaribogaBase that hosts the kaariboga. |
protected KaaribogaAddress |
destination
This is the destination the kaariboga wants to be transfered next. |
protected KaaribogaListener |
kaaribogaListener
The event listener that receives all KaaribogaEvents. |
protected KaaribogaMessageListener |
messageListener
The message listener that receives all KaaribogaMessages. |
private java.lang.String |
name
This is simply the name of the agent. |
Constructor Summary | |
Kaariboga(java.lang.String name)
Constructs a new agent with it's name. |
Method Summary | |
void |
addKaaribogaListener(KaaribogaListener l)
Adds the event listener for kaariboga events. |
void |
addKaaribogaMessageListener(KaaribogaMessageListener l)
Adds the message listener for kaariboga messages. |
protected void |
fireDestroyRequest()
Fires a destroy request to the kaaribogaListener. |
protected void |
fireDispatchRequest()
Fires a dispatch request to the kaaribogaListener. |
protected void |
fireKaaribogaMessage(KaaribogaMessage m)
Fires a message to the kaaribogaMessageListener. |
protected void |
fireSleepRequest()
Fires a sleep request to the kaaribogaListener. |
KaaribogaAddress |
getDestination()
Gets the destination the kaariboga is going to be transfered next. |
java.lang.String |
getName()
Returns the name of this agent. |
void |
handleMessage(KaaribogaMessage msg)
Handles all kinds of kaariboga messages. |
void |
onArrival()
This is called when the kaariboga arrives on a new base. |
void |
onAwake()
Called when the kaariboga is waked up again. |
void |
onCreate()
This function is called on the first creation of the kaariboga. |
void |
onDestroy()
This is called before the kaariboga is destroyed by the base. |
void |
onDispatch()
This is called before the kaariboga is going to be dispatched to a new location. |
void |
onSleep()
Called before the kaariboga is send to sleep, maybe because it is going to be saved on a disk or just to save computation time. |
void |
run()
Run is the main method of the kaariboga thread. |
void |
setBase(KaaribogaBase b)
This is called by the base if a new kaariboga is created or received. |
java.lang.String |
toString()
Prints out an agents String representation. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected transient KaaribogaBase base
private java.lang.String name
protected KaaribogaAddress destination
protected transient KaaribogaListener kaaribogaListener
protected transient KaaribogaMessageListener messageListener
Constructor Detail |
public Kaariboga(java.lang.String name)
name
- The name of the agent. The Base class provides a
method to generate a unique name.Method Detail |
public void run()
run
in interface java.lang.Runnable
public final void setBase(KaaribogaBase b)
b
- The KaaribogaBase that hosts the agent.public java.lang.String getName()
public void onCreate()
public void onDestroy()
public void onArrival()
public void onDispatch()
public void onSleep()
public void onAwake()
public void handleMessage(KaaribogaMessage msg)
handleMessage
in interface KbMessageHandler
protected void fireDispatchRequest()
protected void fireDestroyRequest()
protected void fireSleepRequest()
protected void fireKaaribogaMessage(KaaribogaMessage m)
public KaaribogaAddress getDestination()
public void addKaaribogaListener(KaaribogaListener l)
l
- The KaaribogaEventListener that listens to kaariboga events
from this agent, usually the base.public void addKaaribogaMessageListener(KaaribogaMessageListener l)
l
- The KaaribogaMessageListener that listens to kaariboga messages
from this agent, usually the base.public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |