Class DefaultExecutionContext

  • All Implemented Interfaces:
    org.praxislive.core.ExecutionContext

    public class DefaultExecutionContext
    extends Object
    implements org.praxislive.core.ExecutionContext
    Default implementation of ExecutionContext for use with AbstractRoot
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.praxislive.core.ExecutionContext

        org.praxislive.core.ExecutionContext.ClockListener, org.praxislive.core.ExecutionContext.State, org.praxislive.core.ExecutionContext.StateListener
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultExecutionContext​(long time)
      Create a DefaultExecutionContext
    • Constructor Detail

      • DefaultExecutionContext

        public DefaultExecutionContext​(long time)
        Create a DefaultExecutionContext
        Parameters:
        time - initial clock time / start time
    • Method Detail

      • addStateListener

        public void addStateListener​(org.praxislive.core.ExecutionContext.StateListener listener)
        Specified by:
        addStateListener in interface org.praxislive.core.ExecutionContext
      • removeStateListener

        public void removeStateListener​(org.praxislive.core.ExecutionContext.StateListener listener)
        Specified by:
        removeStateListener in interface org.praxislive.core.ExecutionContext
      • addClockListener

        public void addClockListener​(org.praxislive.core.ExecutionContext.ClockListener listener)
        Specified by:
        addClockListener in interface org.praxislive.core.ExecutionContext
      • removeClockListener

        public void removeClockListener​(org.praxislive.core.ExecutionContext.ClockListener listener)
        Specified by:
        removeClockListener in interface org.praxislive.core.ExecutionContext
      • updateState

        protected void updateState​(long time,
                                   org.praxislive.core.ExecutionContext.State state)
        Update the state. Will call all state listeners.
        Parameters:
        time - time of state change (if ACTIVE also the new start time)
        state - new state
        Throws:
        IllegalStateException - if attempting to reset to NEW from another state, or attempting to set to another state if current state is TERMINATED
      • getState

        public org.praxislive.core.ExecutionContext.State getState()
        Specified by:
        getState in interface org.praxislive.core.ExecutionContext
      • updateClock

        protected void updateClock​(long time)
        Update the clock time. Will call all clock listeners.
        Parameters:
        time -
      • getTime

        public long getTime()
        Specified by:
        getTime in interface org.praxislive.core.ExecutionContext
      • getStartTime

        public long getStartTime()
        Specified by:
        getStartTime in interface org.praxislive.core.ExecutionContext