public class SimulationService
extends java.lang.Object
implements jadex.bridge.service.types.simulation.ISimulationService, jadex.commons.IPropertiesProvider
Modifier and Type | Class and Description |
---|---|
class |
SimulationService.IdleListener
Listener on the execution service.
|
Modifier and Type | Field and Description |
---|---|
protected jadex.bridge.IInternalAccess |
access
The containing component.
|
protected jadex.bridge.service.types.clock.IClockService |
clockservice
The clock service.
|
protected boolean |
executing
The executing flag.
|
protected jadex.bridge.service.types.execution.IExecutionService |
exeservice
The execution service.
|
protected SimulationService.IdleListener |
idlelistener
The idle future listener.
|
protected java.util.List |
listeners
The listeners.
|
protected java.lang.String |
mode
The execution mode.
|
protected boolean |
startoninit
Flag to indicate that simulation should be started after service is inited.
|
protected jadex.commons.future.Future |
stepfuture
The future (if any) indicating when a step is finished.
|
protected long |
timesteptime
The time of a time step.
|
Constructor and Description |
---|
SimulationService()
Create a new execution control.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(jadex.commons.IChangeListener listener)
Add a change listener.
|
protected void |
advanceClock()
Trigger clock execution.
|
jadex.bridge.service.types.clock.IClockService |
getClockService()
Get the platform clock.
|
jadex.bridge.service.types.execution.IExecutionService |
getExecutorService()
Get the executor service.
|
jadex.commons.future.IFuture<java.lang.String> |
getMode()
Get the execution mode.
|
jadex.commons.future.IFuture<jadex.commons.Properties> |
getProperties()
Write current state into properties.
|
jadex.commons.future.IFuture<java.lang.Boolean> |
isExecuting()
Test if context is executing.
|
protected void |
notifyListeners(jadex.commons.ChangeEvent event)
Notify the listeners.
|
jadex.commons.future.IFuture<java.lang.Void> |
pause()
Pause the execution (can be resumed via start or step).
|
void |
removeChangeListener(jadex.commons.IChangeListener listener)
Remove a change listener.
|
protected void |
scheduleAdvanceClock()
Start clock execution.
|
jadex.commons.future.IFuture<java.lang.Void> |
setClockType(java.lang.String type)
Set the clock type.
|
void |
setExecuting(boolean executing)
Set the executing state.
|
protected void |
setIdle()
Stop execution.
|
void |
setMode(java.lang.String mode)
Set the execution mode.
|
jadex.commons.future.IFuture<java.lang.Void> |
setProperties(jadex.commons.Properties props)
Update from given properties.
|
jadex.commons.future.IFuture<java.lang.Void> |
shutdownService()
Shutdown the service.
|
jadex.commons.future.IFuture<java.lang.Void> |
start()
Restart the execution after pause.
|
jadex.commons.future.IFuture<java.lang.Void> |
startService()
Start (and run) the execution.
|
jadex.commons.future.IFuture<java.lang.Void> |
stepEvent()
Perform one event.
|
jadex.commons.future.IFuture<java.lang.Void> |
stepTime()
Perform all actions belonging to one time point.
|
protected jadex.bridge.IInternalAccess access
protected java.lang.String mode
protected boolean executing
protected java.util.List listeners
protected long timesteptime
protected jadex.bridge.service.types.clock.IClockService clockservice
protected jadex.bridge.service.types.execution.IExecutionService exeservice
protected jadex.commons.future.Future stepfuture
protected SimulationService.IdleListener idlelistener
protected boolean startoninit
public jadex.commons.future.IFuture<java.lang.Void> shutdownService()
listener
- The listener.public jadex.commons.future.IFuture<java.lang.Void> startService()
public jadex.commons.future.IFuture<java.lang.Void> pause()
pause
in interface jadex.bridge.service.types.simulation.ISimulationService
public jadex.commons.future.IFuture<java.lang.Void> start()
start
in interface jadex.bridge.service.types.simulation.ISimulationService
public jadex.commons.future.IFuture<java.lang.Void> stepEvent()
stepEvent
in interface jadex.bridge.service.types.simulation.ISimulationService
public jadex.commons.future.IFuture<java.lang.Void> stepTime()
stepTime
in interface jadex.bridge.service.types.simulation.ISimulationService
public jadex.commons.future.IFuture<java.lang.String> getMode()
getMode
in interface jadex.bridge.service.types.simulation.ISimulationService
public void setMode(java.lang.String mode)
mode
- The mode.public jadex.commons.future.IFuture<java.lang.Void> setClockType(java.lang.String type)
setClockType
in interface jadex.bridge.service.types.simulation.ISimulationService
type
- The clock type.public jadex.commons.future.IFuture<java.lang.Boolean> isExecuting()
isExecuting
in interface jadex.bridge.service.types.simulation.ISimulationService
public void addChangeListener(jadex.commons.IChangeListener listener)
addChangeListener
in interface jadex.bridge.service.types.simulation.ISimulationService
listener
- The change listener.public void removeChangeListener(jadex.commons.IChangeListener listener)
removeChangeListener
in interface jadex.bridge.service.types.simulation.ISimulationService
listener
- The change listener.public void setExecuting(boolean executing)
protected void notifyListeners(jadex.commons.ChangeEvent event)
public jadex.bridge.service.types.clock.IClockService getClockService()
getClockService
in interface jadex.bridge.service.types.simulation.ISimulationService
public jadex.bridge.service.types.execution.IExecutionService getExecutorService()
getExecutorService
in interface jadex.bridge.service.types.simulation.ISimulationService
protected void setIdle()
protected void scheduleAdvanceClock()
protected void advanceClock()
public jadex.commons.future.IFuture<java.lang.Void> setProperties(jadex.commons.Properties props)
setProperties
in interface jadex.commons.IPropertiesProvider
public jadex.commons.future.IFuture<jadex.commons.Properties> getProperties()
getProperties
in interface jadex.commons.IPropertiesProvider