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.ServiceHelperpublic long getSynchTimeDifferenceMillis()
throws jade.core.ServiceException
SimulationServiceHelpergetSynchTimeDifferenceMillis in interface SimulationServiceHelperjade.core.ServiceException - the ServiceExceptionpublic long getSynchTimeMillis()
throws jade.core.ServiceException
SimulationServiceHelpergetSynchTimeMillis in interface SimulationServiceHelperjade.core.ServiceException - the ServiceExceptionpublic java.util.Date getSynchTimeDate()
throws jade.core.ServiceException
SimulationServiceHelpergetSynchTimeDate in interface SimulationServiceHelperjade.core.ServiceException - the ServiceExceptionpublic void setAgentMigration(java.util.Vector<LoadAgentMap.AID_Container> transferAgents) throws jade.core.ServiceException
SimulationServiceHelpersetAgentMigration in interface SimulationServiceHelpertransferAgents - the new agent migrationjade.core.ServiceException - the ServiceExceptionLoadAgentMap.AID_Containerpublic void stopSimulationAgents()
throws jade.core.ServiceException
SimulationServiceHelperstopSimulationAgents in interface SimulationServiceHelperjade.core.ServiceException - the ServiceExceptionpublic void setPauseSimulation(boolean pause)
throws jade.core.ServiceException
SimulationServiceHelpersetPauseSimulation in interface SimulationServiceHelperpause - the new pause simulationjade.core.ServiceException - the ServiceExceptionpublic void setManagerAgent(jade.core.AID agentAddress)
throws jade.core.ServiceException
SimulationServiceHelpersetManagerAgent in interface SimulationServiceHelperagentAddress - the new manager agentjade.core.ServiceException - the ServiceExceptionpublic jade.core.AID getManagerAgent()
throws jade.core.ServiceException
SimulationServiceHelpergetManagerAgent in interface SimulationServiceHelperjade.core.ServiceException - the ServiceExceptionpublic void sensorPlugIn(ServiceSensor sensor) throws jade.core.ServiceException
SimulationServiceHelperServiceSensor into the SimulationService.sensorPlugIn in interface SimulationServiceHelpersensor - the ServiceSensor to plug injade.core.ServiceException - the ServiceExceptionpublic void sensorPlugIn(ServiceSensor sensor, boolean pasive) throws jade.core.ServiceException
SimulationServiceHelperServiceSensor into the SimulationService.sensorPlugIn in interface SimulationServiceHelpersensor - 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
SimulationServiceHelperServiceSensor into the SimulationService.sensorPlugOut in interface SimulationServiceHelpersensor - the ServiceSensor to plug outjade.core.ServiceException - the ServiceExceptionpublic void sensorPlugIn4Manager(ServiceSensorManager sensor) throws jade.core.ServiceException
SimulationServiceHelperServiceSensorManager into the SimulationService.sensorPlugIn4Manager in interface SimulationServiceHelpersensor - the ServiceSensorManager to plug injade.core.ServiceException - the ServiceExceptionpublic void sensorPlugOut4Manager(ServiceSensorManager sensor) throws jade.core.ServiceException
SimulationServiceHelperServiceSensorManager into the SimulationService.sensorPlugOut4Manager in interface SimulationServiceHelpersensor - the ServiceSensorManager to plug outjade.core.ServiceException - the ServiceExceptionpublic boolean getStepSimulationAsynchronous()
throws jade.core.ServiceException
SimulationServiceHelpergetStepSimulationAsynchronous in interface SimulationServiceHelperjade.core.ServiceException - the ServiceExceptionpublic void setStepSimulationAsynchronous(boolean stepAsynchronous)
throws jade.core.ServiceException
SimulationServiceHelpersetStepSimulationAsynchronous in interface SimulationServiceHelperstepAsynchronous - true, if the notification has to be done asynchronouslyjade.core.ServiceException - the ServiceExceptionpublic void stepSimulation(EnvironmentModel envModel, int answersExpected) throws jade.core.ServiceException
SimulationServiceHelperEnvironmentModel and the number of expected changes / answers.stepSimulation in interface SimulationServiceHelperenvModel - the current or new EnvironmentModelanswersExpected - the changes / answers expected from the simulation agentsjade.core.ServiceException - the ServiceExceptionEnvironmentModelpublic void stepSimulation(EnvironmentModel envModel, int answersExpected, boolean aSynchron) throws jade.core.ServiceException
SimulationServiceHelperEnvironmentModel and the number of expected changes / answers.stepSimulation in interface SimulationServiceHelperenvModel - 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 ServiceExceptionEnvironmentModelpublic boolean notifySensorAgent(jade.core.AID agentAID,
EnvironmentNotification notification)
throws jade.core.ServiceException
SimulationServiceHelpernotifySensorAgent in interface SimulationServiceHelperagentAID - the agent AIDnotification - the notificationjade.core.ServiceException - the ServiceExceptionServiceSensor,
ServiceActuator,
SimulationAgent,
EnvironmentNotificationpublic boolean notifyManagerAgent(EnvironmentNotification notification) throws jade.core.ServiceException
SimulationServiceHelpernotifyManagerAgent in interface SimulationServiceHelpernotification - the notificationjade.core.ServiceException - the ServiceExceptionSimulationManagerAgent,
EnvironmentNotificationpublic EnvironmentModel getEnvironmentModelFromSetup() throws jade.core.ServiceException
SimulationServiceHelperEnvironmentModel from the setup of the end user application.getEnvironmentModelFromSetup in interface SimulationServiceHelperjade.core.ServiceException - the service exceptionpublic EnvironmentModel getEnvironmentModel() throws jade.core.ServiceException
SimulationServiceHelperEnvironmentModel.getEnvironmentModel in interface SimulationServiceHelperjade.core.ServiceException - the ServiceExceptionEnvironmentModelpublic void setEnvironmentModel(EnvironmentModel envModel) throws jade.core.ServiceException
SimulationServiceHelperEnvironmentModel without
a direct notification to the involved agents.setEnvironmentModel in interface SimulationServiceHelperenvModel - the current or new EnvironmentModel instancejade.core.ServiceException - the ServiceExceptionEnvironmentModelpublic void setEnvironmentModel(EnvironmentModel envModel, boolean notifySensorAgents) throws jade.core.ServiceException
SimulationServiceHelperEnvironmentModel without
a direct notification to the involved agents.setEnvironmentModel in interface SimulationServiceHelperenvModel - the current or new EnvironmentModel instancenotifySensorAgents - true, if the sensor agents should be also notifiedjade.core.ServiceException - the ServiceExceptionEnvironmentModelpublic void setEnvironmentInstanceNextPart(jade.core.AID fromAgent,
java.lang.Object nextPart)
throws jade.core.ServiceException
SimulationServiceHelperSimulationAgent in order to set their part
of the environment change.setEnvironmentInstanceNextPart in interface SimulationServiceHelperfromAgent - the AID of the agentnextPart - the agents part for the next environmentjade.core.ServiceException - the ServiceExceptionSimulationAgentpublic java.util.Hashtable<jade.core.AID,java.lang.Object> getEnvironmentInstanceNextParts()
throws jade.core.ServiceException
SimulationServiceHelperSimulationAgent.getEnvironmentInstanceNextParts in interface SimulationServiceHelperjade.core.ServiceException - the ServiceExceptionpublic void resetEnvironmentInstanceNextParts()
throws jade.core.ServiceException
SimulationServiceHelperresetEnvironmentInstanceNextParts in interface SimulationServiceHelperjade.core.ServiceException - the ServiceExceptionpublic void displayAgentRegister(AbstractDisplayAgent displayAgent) throws jade.core.ServiceException
SimulationServiceHelperdisplayAgentRegister in interface SimulationServiceHelperdisplayAgent - the instance of the display agentjade.core.ServiceException - the service exceptionAbstractDisplayAgent,
SimulationServicepublic void displayAgentUnregister(AbstractDisplayAgent displayAgent) throws jade.core.ServiceException
SimulationServiceHelperdisplayAgentUnregister in interface SimulationServiceHelperdisplayAgent - the instance of the display agentjade.core.ServiceException - the service exceptionAbstractDisplayAgent,
SimulationServicepublic void displayAgentSetEnvironmentModel(EnvironmentModel envModel) throws jade.core.ServiceException
SimulationServiceHelperdisplayAgentSetEnvironmentModel in interface SimulationServiceHelperenvModel - the EnvironmentModeljade.core.ServiceException - the service exceptionAbstractDisplayAgentpublic void displayAgentNotification(EnvironmentNotification notification) throws jade.core.ServiceException
SimulationServiceHelperdisplayAgentNotification in interface SimulationServiceHelpernotification - the EnvironmentNotificationjade.core.ServiceException - the service exception