public abstract class SimulationAgent extends jade.core.Agent implements ServiceSensorInterface
SimulationService
.SimulationService
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected EnvironmentModel |
myEnvironmentModel
The current EnvironmentModel.
|
protected ServiceSensor |
mySensor
The ServiceSensor of this agent.
|
Constructor and Description |
---|
SimulationAgent()
Instantiates a new simulation agent as an active agent.
|
SimulationAgent(boolean passive)
Instantiates a new simulation agent as a passive agent.
|
Modifier and Type | Method and Description |
---|---|
void |
addSimulationServiceListener(ServiceSensorListener simulationServiceListener)
Adds the simulation service listener.
|
protected void |
afterClone() |
protected void |
afterMove() |
protected void |
beforeClone() |
protected void |
beforeMove() |
protected void |
checkAndActOnEnvironmentChanges()
This Method checks if the environment changed in the meantime.
|
protected void |
deregisterDFService()
Unregisters a service for the agency to the DFService of JADE.
|
protected jade.domain.FIPAAgentManagement.DFAgentDescription[] |
findAgentsByServiceType(java.lang.String serviceType)
Find and returns agents by a service type.
|
protected EnvironmentModel |
getEnvironmentModelFromSimulationService()
Grab the environment model from the simulation service.
|
protected EnvironmentNotification |
onEnvironmentNotification(EnvironmentNotification notification)
This method will be executed if a ManagerNotification arrives this agent.
|
abstract void |
onEnvironmentStimulus()
This method is called if a stimulus from the outside reached this agent.
|
protected void |
registerDFService(java.lang.String type,
java.lang.String name,
java.lang.String ownership)
Registers a service for the agency to the DFService of JADE.
|
void |
removeSimulationServiceListener(ServiceSensorListener simulationServiceListener)
Removes the simulation service listener.
|
boolean |
sendAgentNotification(jade.core.AID receiverAID,
java.lang.Object notification)
This method can be used to transfer any kind of information to one member of the current environment model.
|
void |
sendDisplayAgentNotification(DisplayAgentNotification displayAgentNotification)
Notify display agents about changes with a
DisplayAgentNotification . |
boolean |
sendManagerNotification(java.lang.Object notification)
This method can be used to transfer any kind of information to the Manager of the current environment model.
|
protected void |
sensorPlugIn()
This Method plugs IN the service sensor.
|
protected void |
sensorPlugOut()
This Method plugs OUT the service sensor.
|
void |
setEnvironmentModel(EnvironmentModel envModel,
boolean aSynchron)
This method will be used by the
ServiceActuator to inform
this agent about changes in the environment. |
protected void |
setMyStimulusAnswer(java.lang.Object myNextState)
This method sets the answer respectively the change of a single simulation agent
back to the central simulation manager.
|
void |
setNotification(EnvironmentNotification notification)
This method can be invoked from the simulation service, if
a notification for the manager has to be delivered.
|
protected void |
setup() |
protected void |
takeDown() |
addBehaviour, blockingReceive, blockingReceive, blockingReceive, blockingReceive, changeStateTo, clean, createMessageQueue, doActivate, doClone, doDelete, doMove, doSuspend, doTimeOut, doWait, doWait, doWake, getAgentState, getAID, getAID, getAMS, getArguments, getBehavioursCnt, getBootProperties, getContainerController, getContentManager, getCurQueueSize, getDefaultDF, getExecutedBehavioursCnt, getHap, getHelper, getLocalName, getName, getO2AInterface, getO2AObject, getPostedMessagesCnt, getProperty, getQueueSize, getReceivedMessagesCnt, getState, here, isAlive, isRestarting, join, notifyChangeBehaviourState, notifyRestarted, postMessage, putBack, putO2AObject, receive, receive, registerO2AInterface, removeBehaviour, removeTimer, restartLater, restore, restoreBufferedState, run, send, setArguments, setEnabledO2ACommunication, setGenerateBehaviourEvents, setO2AManager, setQueueSize, waitUntilStarted, write
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doDelete, getAID, setMigration, setPauseSimulation
protected ServiceSensor mySensor
protected EnvironmentModel myEnvironmentModel
public SimulationAgent()
public SimulationAgent(boolean passive)
passive
- the passiveprotected 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
protected void beforeClone()
beforeClone
in class jade.core.Agent
protected void afterClone()
afterClone
in class jade.core.Agent
protected void takeDown()
takeDown
in class jade.core.Agent
protected void sensorPlugIn()
protected void sensorPlugOut()
protected EnvironmentModel getEnvironmentModelFromSimulationService()
protected void checkAndActOnEnvironmentChanges()
public void setEnvironmentModel(EnvironmentModel envModel, boolean aSynchron)
ServiceSensorInterface
ServiceActuator
to inform
this agent about changes in the environment. It can be either used
to do this asynchronously or synchronously. It is highly recommended
to do this asynchronously, so that the agency can act parallel and not
sequentially.setEnvironmentModel
in interface ServiceSensorInterface
envModel
- the current or new EnvironmentModelaSynchron
- true, if this should be done asynchronouslypublic abstract void onEnvironmentStimulus()
protected void setMyStimulusAnswer(java.lang.Object myNextState)
myNextState
- the next state of this agent in the next instance of the environment modelpublic boolean sendManagerNotification(java.lang.Object notification)
notification
- the notificationpublic boolean sendAgentNotification(jade.core.AID receiverAID, java.lang.Object notification)
receiverAID
- the AID of receiver agentnotification
- the notificationpublic void sendDisplayAgentNotification(DisplayAgentNotification displayAgentNotification)
DisplayAgentNotification
.displayAgentNotification
- the display agent messagepublic void setNotification(EnvironmentNotification notification)
ServiceSensorInterface
setNotification
in interface ServiceSensorInterface
notification
- the new notificationprotected EnvironmentNotification onEnvironmentNotification(EnvironmentNotification notification)
notification
- the notificationpublic void addSimulationServiceListener(ServiceSensorListener simulationServiceListener)
simulationServiceListener
- the simulation service listenerpublic void removeSimulationServiceListener(ServiceSensorListener simulationServiceListener)
simulationServiceListener
- the simulation service listenerprotected void registerDFService(java.lang.String type, java.lang.String name, java.lang.String ownership)
type
- the typename
- the nameprotected void deregisterDFService()
protected jade.domain.FIPAAgentManagement.DFAgentDescription[] findAgentsByServiceType(java.lang.String serviceType)
serviceType
- the service type