public abstract class SimulationServiceBehaviour extends jade.core.behaviours.Behaviour implements ServiceSensorInterface
SimulationService
in a behaviour instead of
the usage through SimulationAgent
.Modifier and Type | Field and Description |
---|---|
protected EnvironmentModel |
myEnvironmentModel
The current EnvironmentModel.
|
protected ServiceSensor |
mySensor
The ServiceSensor of this agent.
|
Constructor and Description |
---|
SimulationServiceBehaviour(jade.core.Agent agent)
Instantiates a new SimulationServiceBehaviour as an active agent, which
means that the current agent is asked to react on notifications or environment changes.
|
SimulationServiceBehaviour(jade.core.Agent agent,
boolean passive)
Instantiates a new simulation agent as a passive agent.
|
Modifier and Type | Method and Description |
---|---|
void |
action() |
void |
addSimulationServiceListener(ServiceSensorListener simulationServiceListener)
Adds the simulation service listener.
|
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.
|
void |
doDelete()
Will delete/kill the current agent.
|
boolean |
done() |
protected jade.domain.FIPAAgentManagement.DFAgentDescription[] |
findAgentsByServiceType(java.lang.String serviceType)
Find and returns agents by a service type.
|
jade.core.Agent |
getAgent()
Gets the current agent.
|
jade.core.AID |
getAID()
Returns the AID of the current Agent.
|
int |
onEnd() |
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.
|
void |
onStart() |
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. |
abstract void |
setMigration(jade.core.Location newLocation)
This method will be used by the ServiceActuator (class) to inform
this agent about its new migration location.
|
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.
|
actionWrapper, block, block, getBehaviourName, getDataStore, getExecutionState, getParent, getRestartCounter, handle, handleBlockEvent, handleRestartEvent, isRunnable, reset, restart, root, setAgent, setBehaviourName, setDataStore, setExecutionState
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setPauseSimulation
protected ServiceSensor mySensor
protected EnvironmentModel myEnvironmentModel
public SimulationServiceBehaviour(jade.core.Agent agent)
agent
- the agentpublic SimulationServiceBehaviour(jade.core.Agent agent, boolean passive)
agent
- the agentpassive
- the passivepublic jade.core.Agent getAgent()
getAgent
in class jade.core.behaviours.Behaviour
public void action()
action
in class jade.core.behaviours.Behaviour
public jade.core.AID getAID()
ServiceSensorInterface
getAID
in interface ServiceSensorInterface
public void doDelete()
ServiceSensorInterface
doDelete
in interface ServiceSensorInterface
public boolean done()
done
in class jade.core.behaviours.Behaviour
public void onStart()
onStart
in class jade.core.behaviours.Behaviour
public int onEnd()
onEnd
in class jade.core.behaviours.Behaviour
protected void sensorPlugIn()
protected void sensorPlugOut()
protected void checkAndActOnEnvironmentChanges()
public abstract void setMigration(jade.core.Location newLocation)
setMigration
in interface ServiceSensorInterface
newLocation
- the new Location for the migrationpublic void setEnvironmentModel(EnvironmentModel envModel, boolean aSynchron)
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)
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