Class DefaultExecutionContext

java.lang.Object
org.praxislive.base.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
    Create a DefaultExecutionContext
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addClockListener(org.praxislive.core.ExecutionContext.ClockListener listener)
     
    void
    addStateListener(org.praxislive.core.ExecutionContext.StateListener listener)
     
    long
     
    org.praxislive.core.ExecutionContext.State
     
    long
     
    void
    removeClockListener(org.praxislive.core.ExecutionContext.ClockListener listener)
     
    void
    removeStateListener(org.praxislive.core.ExecutionContext.StateListener listener)
     
    protected void
    updateClock(long time)
    Update the clock time.
    protected void
    updateState(long time, org.praxislive.core.ExecutionContext.State state)
    Update the state.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.praxislive.core.ExecutionContext

    getPeriod
  • Constructor Details

    • DefaultExecutionContext

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

    • 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