|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjade.core.Agent
gr.demokritos.iit.jinsect.distributed.MobileAgent
public class MobileAgent
This is an example of mobile agent.
This class contains the resources used by the agent behaviours: the counter,
the
flag cntEnabled, and the list of visited locations.
At the setup it creates a gui and adds behaviours to: get the list of
available locations from AMS, serve the incoming messages, and
to increment the counter.
In particular, notice the usage of the two methods beforeMove()
and
afterMove()
to execute some application-specific tasks just before and just after
the agent migration takes effect.
Because this agent has a GUI, it extends the class GuiAgent that, in turn,
extends the class Agent. Being the GUI a different thread, the communication
between the agent and its GUI is based on event passing.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class jade.core.Agent |
---|
jade.core.Agent.Interrupted |
Field Summary | |
---|---|
static int |
CLONE_EVENT
|
static int |
CONTINUE_EVENT
|
static int |
EXIT
|
protected java.util.ArrayList |
Locations
|
static int |
MOVE_EVENT
|
static int |
REFRESH_EVENT
|
static int |
STOP_EVENT
|
Fields inherited from class jade.core.Agent |
---|
AP_ACTIVE, AP_DELETED, AP_IDLE, AP_INITIATED, AP_MAX, AP_MIN, AP_SUSPENDED, AP_WAITING, D_ACTIVE, D_MAX, D_MIN, D_RETIRED, D_SUSPENDED, D_UNKNOWN |
Constructor Summary | |
---|---|
MobileAgent()
|
Method Summary | |
---|---|
void |
afterLoad()
|
protected void |
afterMove()
This method is executed as soon as the agent arrives to the new destination. |
void |
afterReload()
|
void |
afterThaw()
|
void |
beforeFreeze()
|
protected void |
beforeMove()
This method is executed just before moving the agent to another location. |
void |
beforeReload()
|
void |
setup()
|
void |
updateLocations(java.util.Iterator iLocationIterator)
|
Methods inherited from class jade.core.Agent |
---|
addBehaviour, afterClone, beforeClone, blockingReceive, blockingReceive, blockingReceive, blockingReceive, changeStateTo, clean, doActivate, doClone, doDelete, doMove, doSuspend, doTimeOut, doWait, doWait, doWake, getAgentState, getAID, getAMS, getArguments, getContainerController, getContentManager, getCurQueueSize, getDefaultDF, getHap, getHelper, getLocalName, getName, getO2AObject, getProperty, getQueueSize, getState, here, join, notifyChangeBehaviourState, notifyRestarted, postMessage, putBack, putO2AObject, receive, receive, removeBehaviour, restartLater, restore, restoreBufferedState, run, send, setArguments, setEnabledO2ACommunication, setGenerateBehaviourEvents, setQueueSize, takeDown, waitUntilStarted, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient java.util.ArrayList Locations
public static final int EXIT
public static final int MOVE_EVENT
public static final int STOP_EVENT
public static final int CONTINUE_EVENT
public static final int REFRESH_EVENT
public static final int CLONE_EVENT
Constructor Detail |
---|
public MobileAgent()
Method Detail |
---|
public void setup()
setup
in class jade.core.Agent
protected void beforeMove()
beforeMove
in class jade.core.Agent
protected void afterMove()
afterMove
in class jade.core.Agent
public void afterLoad()
public void beforeFreeze()
public void afterThaw()
public void beforeReload()
public void afterReload()
public void updateLocations(java.util.Iterator iLocationIterator)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |