- java.lang.Object
-
- org.praxislive.base.DefaultExecutionContext
-
- All Implemented Interfaces:
ExecutionContext
public class DefaultExecutionContext extends Object implements ExecutionContext
Default implementation ofExecutionContextfor use withAbstractRoot
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.praxislive.core.ExecutionContext
ExecutionContext.ClockListener, ExecutionContext.State, ExecutionContext.StateListener
-
-
Constructor Summary
Constructors Constructor Description DefaultExecutionContext(long time)Create a DefaultExecutionContext
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddClockListener(ExecutionContext.ClockListener listener)voidaddStateListener(ExecutionContext.StateListener listener)longgetStartTime()ExecutionContext.StategetState()longgetTime()voidremoveClockListener(ExecutionContext.ClockListener listener)voidremoveStateListener(ExecutionContext.StateListener listener)protected voidupdateClock(long time)Update the clock time.protected voidupdateState(long time, 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
-
-
-
-
Method Detail
-
addStateListener
public void addStateListener(ExecutionContext.StateListener listener)
- Specified by:
addStateListenerin interfaceExecutionContext
-
removeStateListener
public void removeStateListener(ExecutionContext.StateListener listener)
- Specified by:
removeStateListenerin interfaceExecutionContext
-
addClockListener
public void addClockListener(ExecutionContext.ClockListener listener)
- Specified by:
addClockListenerin interfaceExecutionContext
-
removeClockListener
public void removeClockListener(ExecutionContext.ClockListener listener)
- Specified by:
removeClockListenerin interfaceExecutionContext
-
updateState
protected void updateState(long time, 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 ExecutionContext.State getState()
- Specified by:
getStatein interfaceExecutionContext
-
updateClock
protected void updateClock(long time)
Update the clock time. Will call all clock listeners.- Parameters:
time-
-
getTime
public long getTime()
- Specified by:
getTimein interfaceExecutionContext
-
getStartTime
public long getStartTime()
- Specified by:
getStartTimein interfaceExecutionContext
-
-