Class SimulationService
- java.lang.Object
- 
- jadex.platform.service.simulation.SimulationService
 
- 
- All Implemented Interfaces:
- ISimulationService,- IPropertiesProvider
 
 public class SimulationService extends java.lang.Object implements ISimulationService, IPropertiesProvider The execution control is the access point for controlling the execution of one application. It provides basic features for starting, stopping and stepwise execution.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classSimulationService.IdleListenerListener on the execution service.
 - 
Field SummaryFields Modifier and Type Field Description protected IInternalAccessaccessThe containing component.protected java.util.List<IFuture<?>>advanceblockersBlockers that prevent the clock from advancing.protected IClockServiceclockserviceThe clock service.protected booleanexecutingThe executing flag.protected IExecutionServiceexeserviceThe execution service.protected SimulationService.IdleListeneridlelistenerThe idle future listener.protected java.util.ListlistenersThe listeners.protected java.lang.StringmodeThe execution mode.protected static java.util.Map<Future<?>,java.lang.String>openfutsprotected booleanstartoninitFlag to indicate that simulation should be started after service is inited.protected FuturestepfutureThe future (if any) indicating when a step is finished.protected longtimesteptimeThe time of a time step.- 
Fields inherited from interface jadex.bridge.service.types.simulation.ISimulationServiceMODE_ACTION_STEP, MODE_NORMAL, MODE_TIME_STEP
 
- 
 - 
Constructor SummaryConstructors Constructor Description SimulationService()Create a new execution control.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.lang.Void>addAdvanceBlocker(IFuture<?> blocker)Adds a blocker to the clock that prevents the clock from advancing until the future is triggered either by result or exception.voidaddChangeListener(IChangeListener listener)Add a change listener.protected voidadvanceClock()Trigger clock execution.IClockServicegetClockService()Get the platform clock.IExecutionServicegetExecutorService()Get the executor service.IFuture<java.lang.String>getMode()Get the execution mode.IFuture<Properties>getProperties()Write current state into properties.IFuture<java.lang.Boolean>isExecuting()Test if context is executing.protected voidnotifyListeners(ChangeEvent event)Notify the listeners.IFuture<java.lang.Void>pause()Pause the execution (can be resumed via start or step).voidremoveChangeListener(IChangeListener listener)Remove a change listener.protected voidscheduleAdvanceClock()Start clock execution.IFuture<java.lang.Void>setClockType(java.lang.String type)Set the clock type.voidsetExecuting(boolean executing)Set the executing state.protected voidsetIdle()Stop execution.voidsetMode(java.lang.String mode)Set the execution mode.IFuture<java.lang.Void>setProperties(Properties props)Update from given properties.IFuture<java.lang.Void>shutdownService()Shutdown the service.IFuture<java.lang.Void>start()Restart the execution after pause.IFuture<java.lang.Void>startService()Start (and run) the execution.IFuture<java.lang.Void>stepEvent()Perform one event.IFuture<java.lang.Void>stepTime()Perform all actions belonging to one time point.protected IFuture<java.lang.Void>waitForBlockers()Waits for blockers
 
- 
- 
- 
Field Detail- 
accessprotected IInternalAccess access The containing component.
 - 
modeprotected java.lang.String mode The execution mode.
 - 
executingprotected boolean executing The executing flag.
 - 
listenersprotected java.util.List listeners The listeners.
 - 
timesteptimeprotected long timesteptime The time of a time step.
 - 
clockserviceprotected IClockService clockservice The clock service.
 - 
exeserviceprotected IExecutionService exeservice The execution service.
 - 
stepfutureprotected Future stepfuture The future (if any) indicating when a step is finished.
 - 
advanceblockersprotected java.util.List<IFuture<?>> advanceblockers Blockers that prevent the clock from advancing.
 - 
idlelistenerprotected SimulationService.IdleListener idlelistener The idle future listener.
 - 
startoninitprotected boolean startoninit Flag to indicate that simulation should be started after service is inited.
 - 
openfutsprotected static final java.util.Map<Future<?>,java.lang.String> openfuts 
 
- 
 - 
Method Detail- 
shutdownServicepublic IFuture<java.lang.Void> shutdownService() Shutdown the service.- Parameters:
- listener- The listener.
 
 - 
startServicepublic IFuture<java.lang.Void> startService() Start (and run) the execution.
 - 
pausepublic IFuture<java.lang.Void> pause() Pause the execution (can be resumed via start or step).- Specified by:
- pausein interface- ISimulationService
 
 - 
startpublic IFuture<java.lang.Void> start() Restart the execution after pause.- Specified by:
- startin interface- ISimulationService
 
 - 
stepEventpublic IFuture<java.lang.Void> stepEvent() Perform one event.- Specified by:
- stepEventin interface- ISimulationService
 
 - 
stepTimepublic IFuture<java.lang.Void> stepTime() Perform all actions belonging to one time point.- Specified by:
- stepTimein interface- ISimulationService
 
 - 
getModepublic IFuture<java.lang.String> getMode() Get the execution mode.- Specified by:
- getModein interface- ISimulationService
- Returns:
- The mode.
 
 - 
setModepublic void setMode(java.lang.String mode) Set the execution mode.- Parameters:
- mode- The mode.
 
 - 
setClockTypepublic IFuture<java.lang.Void> setClockType(java.lang.String type) Set the clock type.- Specified by:
- setClockTypein interface- ISimulationService
- Parameters:
- type- The clock type.
 
 - 
isExecutingpublic IFuture<java.lang.Boolean> isExecuting() Test if context is executing.- Specified by:
- isExecutingin interface- ISimulationService
 
 - 
addChangeListenerpublic void addChangeListener(IChangeListener listener) Add a change listener.- Specified by:
- addChangeListenerin interface- ISimulationService
- Parameters:
- listener- The change listener.
 
 - 
removeChangeListenerpublic void removeChangeListener(IChangeListener listener) Remove a change listener.- Specified by:
- removeChangeListenerin interface- ISimulationService
- Parameters:
- listener- The change listener.
 
 - 
setExecutingpublic void setExecuting(boolean executing) Set the executing state.
 - 
notifyListenersprotected void notifyListeners(ChangeEvent event) Notify the listeners.
 - 
getClockServicepublic IClockService getClockService() Get the platform clock.- Specified by:
- getClockServicein interface- ISimulationService
- Returns:
- The clock.
 
 - 
getExecutorServicepublic IExecutionService getExecutorService() Get the executor service.- Specified by:
- getExecutorServicein interface- ISimulationService
- Returns:
- The executor service.
 
 - 
addAdvanceBlockerpublic IFuture<java.lang.Void> addAdvanceBlocker(IFuture<?> blocker) Adds a blocker to the clock that prevents the clock from advancing until the future is triggered either by result or exception.- Specified by:
- addAdvanceBlockerin interface- ISimulationService
- Parameters:
- blocker- The blocking future.
- Returns:
- Null, when added.
 
 - 
setIdleprotected void setIdle() Stop execution.
 - 
scheduleAdvanceClockprotected void scheduleAdvanceClock() Start clock execution.
 - 
advanceClockprotected void advanceClock() Trigger clock execution.
 - 
waitForBlockersprotected IFuture<java.lang.Void> waitForBlockers() Waits for blockers- Returns:
 
 - 
setPropertiespublic IFuture<java.lang.Void> setProperties(Properties props) Update from given properties.- Specified by:
- setPropertiesin interface- IPropertiesProvider
 
 - 
getPropertiespublic IFuture<Properties> getProperties() Write current state into properties.- Specified by:
- getPropertiesin interface- IPropertiesProvider
 
 
- 
 
-