Class SimulationService

    • Field Detail

      • mode

        protected java.lang.String mode
        The execution mode.
      • executing

        protected boolean executing
        The executing flag.
      • listeners

        protected java.util.List listeners
        The listeners.
      • timesteptime

        protected long timesteptime
        The time of a time step.
      • clockservice

        protected IClockService clockservice
        The clock service.
      • stepfuture

        protected Future stepfuture
        The future (if any) indicating when a step is finished.
      • advanceblockers

        protected java.util.List<IFuture<?>> advanceblockers
        Blockers that prevent the clock from advancing.
      • startoninit

        protected boolean startoninit
        Flag to indicate that simulation should be started after service is inited.
      • openfuts

        protected static final java.util.Map<Future<?>,​java.lang.String> openfuts
    • Constructor Detail

      • SimulationService

        public SimulationService()
        Create a new execution control.
    • Method Detail

      • shutdownService

        public IFuture<java.lang.Void> shutdownService()
        Shutdown the service.
        Parameters:
        listener - The listener.
      • startService

        public IFuture<java.lang.Void> startService()
        Start (and run) the execution.
      • pause

        public IFuture<java.lang.Void> pause()
        Pause the execution (can be resumed via start or step).
        Specified by:
        pause in interface ISimulationService
      • setMode

        public void setMode​(java.lang.String mode)
        Set the execution mode.
        Parameters:
        mode - The mode.
      • setClockType

        public IFuture<java.lang.Void> setClockType​(java.lang.String type)
        Set the clock type.
        Specified by:
        setClockType in interface ISimulationService
        Parameters:
        type - The clock type.
      • setExecuting

        public void setExecuting​(boolean executing)
        Set the executing state.
      • notifyListeners

        protected void notifyListeners​(ChangeEvent event)
        Notify the listeners.
      • addAdvanceBlocker

        public 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:
        addAdvanceBlocker in interface ISimulationService
        Parameters:
        blocker - The blocking future.
        Returns:
        Null, when added.
      • setIdle

        protected void setIdle()
        Stop execution.
      • scheduleAdvanceClock

        protected void scheduleAdvanceClock()
        Start clock execution.
      • advanceClock

        protected void advanceClock()
        Trigger clock execution.
      • waitForBlockers

        protected IFuture<java.lang.Void> waitForBlockers()
        Waits for blockers
        Returns: