public class SimulationService.SimulationServiceImpl extends java.lang.Object implements SimulationServiceHelper
SERVICE_NAME, SERVICE_NODE_DESCRIPTION_FILE
Constructor and Description |
---|
SimulationServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
displayAgentNotification(EnvironmentNotification notification)
Notifies all registered DisplayAgents.
|
void |
displayAgentRegister(AbstractDisplayAgent displayAgent)
Registers a DisplayAgent at the SimulationService.
|
void |
displayAgentSetEnvironmentModel(EnvironmentModel envModel)
Notifies all registered DisplayAgents about a new EnvironmentModel.
|
void |
displayAgentUnregister(AbstractDisplayAgent displayAgent)
Unregisters a DisplayAgent at the SimulationService.
|
java.util.Hashtable<jade.core.AID,java.lang.Object> |
getEnvironmentInstanceNextParts()
Gets the parts for the next environment instance coming from different
SimulationAgent . |
EnvironmentModel |
getEnvironmentModel()
Returns the current the
EnvironmentModel . |
EnvironmentModel |
getEnvironmentModelFromSetup()
Returns the
EnvironmentModel from the setup of the end user application. |
jade.core.AID |
getManagerAgent()
Returns the manager agent for the simulation/environment.
|
boolean |
getStepSimulationAsynchronous()
Returns the information, if the notification about environment changes has to be done asynchronously.
|
java.util.Date |
getSynchTimeDate()
Returns the synchronised time as date.
|
long |
getSynchTimeDifferenceMillis()
Returns the difference in milliseconds for synchronised time.
|
long |
getSynchTimeMillis()
Returns the synchronised time in milliseconds.
|
void |
init(jade.core.Agent ag) |
boolean |
notifyManagerAgent(EnvironmentNotification notification)
Notifies a SimulationManager by using an EnvironmentNotification.
|
boolean |
notifySensorAgent(jade.core.AID agentAID,
EnvironmentNotification notification)
Notifies a specified sensor agent by using an EnvironmentNotification.
|
void |
resetEnvironmentInstanceNextParts()
This method will reset the Hashtable of environment changes for the next environment instance.
|
void |
sensorPlugIn(ServiceSensor sensor)
Allows to plug in a
ServiceSensor into the SimulationService. |
void |
sensorPlugIn(ServiceSensor sensor,
boolean pasive)
Allows to plug in a
ServiceSensor into the SimulationService. |
void |
sensorPlugIn4Manager(ServiceSensorManager sensor)
Allows to plug in a
ServiceSensorManager into the SimulationService. |
void |
sensorPlugOut(ServiceSensor sensor)
Allows to plug out a
ServiceSensor into the SimulationService. |
void |
sensorPlugOut4Manager(ServiceSensorManager sensor)
Allows to plug out a
ServiceSensorManager into the SimulationService. |
void |
setAgentMigration(java.util.Vector<LoadAgentMap.AID_Container> transferAgents)
Sets the agents to migrate to a different location/container.
|
void |
setEnvironmentInstanceNextPart(jade.core.AID fromAgent,
java.lang.Object nextPart)
This method can be used by a
SimulationAgent in order to set their part
of the environment change. |
void |
setEnvironmentModel(EnvironmentModel envModel)
Can be used in order to set and distribute an
EnvironmentModel without
a direct notification to the involved agents. |
void |
setEnvironmentModel(EnvironmentModel envModel,
boolean notifySensorAgents)
Can be used in order to set and distribute an
EnvironmentModel without
a direct notification to the involved agents. |
void |
setManagerAgent(jade.core.AID agentAddress)
Sets the manager agent of the simulation/environment.
|
void |
setPauseSimulation(boolean pause)
Sets the pause of the simulation.
|
void |
setStepSimulationAsynchronous(boolean stepAsynchronous)
Sets to step a simulation by notify all involved agents in a asynchronous way.
|
void |
stepSimulation(EnvironmentModel envModel,
int answersExpected)
Steps a simulation by using the current
EnvironmentModel and the number of expected changes / answers. |
void |
stepSimulation(EnvironmentModel envModel,
int answersExpected,
boolean aSynchron)
Steps a simulation by using the current
EnvironmentModel and the number of expected changes / answers. |
void |
stopSimulationAgents()
Stops all agents, which are connected to the SimulationService via the Actuator/Sensor relationship .
|
public void init(jade.core.Agent ag)
init
in interface jade.core.ServiceHelper
public long getSynchTimeDifferenceMillis() throws jade.core.ServiceException
SimulationServiceHelper
getSynchTimeDifferenceMillis
in interface SimulationServiceHelper
jade.core.ServiceException
- the ServiceExceptionpublic long getSynchTimeMillis() throws jade.core.ServiceException
SimulationServiceHelper
getSynchTimeMillis
in interface SimulationServiceHelper
jade.core.ServiceException
- the ServiceExceptionpublic java.util.Date getSynchTimeDate() throws jade.core.ServiceException
SimulationServiceHelper
getSynchTimeDate
in interface SimulationServiceHelper
jade.core.ServiceException
- the ServiceExceptionpublic void setAgentMigration(java.util.Vector<LoadAgentMap.AID_Container> transferAgents) throws jade.core.ServiceException
SimulationServiceHelper
setAgentMigration
in interface SimulationServiceHelper
transferAgents
- the new agent migrationjade.core.ServiceException
- the ServiceExceptionLoadAgentMap.AID_Container
public void stopSimulationAgents() throws jade.core.ServiceException
SimulationServiceHelper
stopSimulationAgents
in interface SimulationServiceHelper
jade.core.ServiceException
- the ServiceExceptionpublic void setPauseSimulation(boolean pause) throws jade.core.ServiceException
SimulationServiceHelper
setPauseSimulation
in interface SimulationServiceHelper
pause
- the new pause simulationjade.core.ServiceException
- the ServiceExceptionpublic void setManagerAgent(jade.core.AID agentAddress) throws jade.core.ServiceException
SimulationServiceHelper
setManagerAgent
in interface SimulationServiceHelper
agentAddress
- the new manager agentjade.core.ServiceException
- the ServiceExceptionpublic jade.core.AID getManagerAgent() throws jade.core.ServiceException
SimulationServiceHelper
getManagerAgent
in interface SimulationServiceHelper
jade.core.ServiceException
- the ServiceExceptionpublic void sensorPlugIn(ServiceSensor sensor) throws jade.core.ServiceException
SimulationServiceHelper
ServiceSensor
into the SimulationService.sensorPlugIn
in interface SimulationServiceHelper
sensor
- the ServiceSensor
to plug injade.core.ServiceException
- the ServiceExceptionpublic void sensorPlugIn(ServiceSensor sensor, boolean pasive) throws jade.core.ServiceException
SimulationServiceHelper
ServiceSensor
into the SimulationService.sensorPlugIn
in interface SimulationServiceHelper
sensor
- the ServiceSensor
to plug inpasive
- true, if the sensor is just listening to the actuator, but that there is no answer to expectjade.core.ServiceException
- the ServiceExceptionpublic void sensorPlugOut(ServiceSensor sensor) throws jade.core.ServiceException
SimulationServiceHelper
ServiceSensor
into the SimulationService.sensorPlugOut
in interface SimulationServiceHelper
sensor
- the ServiceSensor
to plug outjade.core.ServiceException
- the ServiceExceptionpublic void sensorPlugIn4Manager(ServiceSensorManager sensor) throws jade.core.ServiceException
SimulationServiceHelper
ServiceSensorManager
into the SimulationService.sensorPlugIn4Manager
in interface SimulationServiceHelper
sensor
- the ServiceSensorManager
to plug injade.core.ServiceException
- the ServiceExceptionpublic void sensorPlugOut4Manager(ServiceSensorManager sensor) throws jade.core.ServiceException
SimulationServiceHelper
ServiceSensorManager
into the SimulationService.sensorPlugOut4Manager
in interface SimulationServiceHelper
sensor
- the ServiceSensorManager
to plug outjade.core.ServiceException
- the ServiceExceptionpublic boolean getStepSimulationAsynchronous() throws jade.core.ServiceException
SimulationServiceHelper
getStepSimulationAsynchronous
in interface SimulationServiceHelper
jade.core.ServiceException
- the ServiceExceptionpublic void setStepSimulationAsynchronous(boolean stepAsynchronous) throws jade.core.ServiceException
SimulationServiceHelper
setStepSimulationAsynchronous
in interface SimulationServiceHelper
stepAsynchronous
- true, if the notification has to be done asynchronouslyjade.core.ServiceException
- the ServiceExceptionpublic void stepSimulation(EnvironmentModel envModel, int answersExpected) throws jade.core.ServiceException
SimulationServiceHelper
EnvironmentModel
and the number of expected changes / answers.stepSimulation
in interface SimulationServiceHelper
envModel
- the current or new EnvironmentModelanswersExpected
- the changes / answers expected from the simulation agentsjade.core.ServiceException
- the ServiceExceptionEnvironmentModel
public void stepSimulation(EnvironmentModel envModel, int answersExpected, boolean aSynchron) throws jade.core.ServiceException
SimulationServiceHelper
EnvironmentModel
and the number of expected changes / answers.stepSimulation
in interface SimulationServiceHelper
envModel
- the current or new EnvironmentModelanswersExpected
- the changes / answers expected from the simulation agentsaSynchron
- true, if the notification has to be done asynchronouslyjade.core.ServiceException
- the ServiceExceptionEnvironmentModel
public boolean notifySensorAgent(jade.core.AID agentAID, EnvironmentNotification notification) throws jade.core.ServiceException
SimulationServiceHelper
notifySensorAgent
in interface SimulationServiceHelper
agentAID
- the agent AIDnotification
- the notificationjade.core.ServiceException
- the ServiceExceptionServiceSensor
,
ServiceActuator
,
SimulationAgent
,
EnvironmentNotification
public boolean notifyManagerAgent(EnvironmentNotification notification) throws jade.core.ServiceException
SimulationServiceHelper
notifyManagerAgent
in interface SimulationServiceHelper
notification
- the notificationjade.core.ServiceException
- the ServiceExceptionSimulationManagerAgent
,
EnvironmentNotification
public EnvironmentModel getEnvironmentModelFromSetup() throws jade.core.ServiceException
SimulationServiceHelper
EnvironmentModel
from the setup of the end user application.getEnvironmentModelFromSetup
in interface SimulationServiceHelper
jade.core.ServiceException
- the service exceptionpublic EnvironmentModel getEnvironmentModel() throws jade.core.ServiceException
SimulationServiceHelper
EnvironmentModel
.getEnvironmentModel
in interface SimulationServiceHelper
jade.core.ServiceException
- the ServiceExceptionEnvironmentModel
public void setEnvironmentModel(EnvironmentModel envModel) throws jade.core.ServiceException
SimulationServiceHelper
EnvironmentModel
without
a direct notification to the involved agents.setEnvironmentModel
in interface SimulationServiceHelper
envModel
- the current or new EnvironmentModel instancejade.core.ServiceException
- the ServiceExceptionEnvironmentModel
public void setEnvironmentModel(EnvironmentModel envModel, boolean notifySensorAgents) throws jade.core.ServiceException
SimulationServiceHelper
EnvironmentModel
without
a direct notification to the involved agents.setEnvironmentModel
in interface SimulationServiceHelper
envModel
- the current or new EnvironmentModel instancenotifySensorAgents
- true, if the sensor agents should be also notifiedjade.core.ServiceException
- the ServiceExceptionEnvironmentModel
public void setEnvironmentInstanceNextPart(jade.core.AID fromAgent, java.lang.Object nextPart) throws jade.core.ServiceException
SimulationServiceHelper
SimulationAgent
in order to set their part
of the environment change.setEnvironmentInstanceNextPart
in interface SimulationServiceHelper
fromAgent
- the AID of the agentnextPart
- the agents part for the next environmentjade.core.ServiceException
- the ServiceExceptionSimulationAgent
public java.util.Hashtable<jade.core.AID,java.lang.Object> getEnvironmentInstanceNextParts() throws jade.core.ServiceException
SimulationServiceHelper
SimulationAgent
.getEnvironmentInstanceNextParts
in interface SimulationServiceHelper
jade.core.ServiceException
- the ServiceExceptionpublic void resetEnvironmentInstanceNextParts() throws jade.core.ServiceException
SimulationServiceHelper
resetEnvironmentInstanceNextParts
in interface SimulationServiceHelper
jade.core.ServiceException
- the ServiceExceptionpublic void displayAgentRegister(AbstractDisplayAgent displayAgent) throws jade.core.ServiceException
SimulationServiceHelper
displayAgentRegister
in interface SimulationServiceHelper
displayAgent
- the instance of the display agentjade.core.ServiceException
- the service exceptionAbstractDisplayAgent
,
SimulationService
public void displayAgentUnregister(AbstractDisplayAgent displayAgent) throws jade.core.ServiceException
SimulationServiceHelper
displayAgentUnregister
in interface SimulationServiceHelper
displayAgent
- the instance of the display agentjade.core.ServiceException
- the service exceptionAbstractDisplayAgent
,
SimulationService
public void displayAgentSetEnvironmentModel(EnvironmentModel envModel) throws jade.core.ServiceException
SimulationServiceHelper
displayAgentSetEnvironmentModel
in interface SimulationServiceHelper
envModel
- the EnvironmentModeljade.core.ServiceException
- the service exceptionAbstractDisplayAgent
public void displayAgentNotification(EnvironmentNotification notification) throws jade.core.ServiceException
SimulationServiceHelper
displayAgentNotification
in interface SimulationServiceHelper
notification
- the EnvironmentNotificationjade.core.ServiceException
- the service exception