Interface Process

All Superinterfaces:
CompilableControlFlow, Component
All Known Subinterfaces:
AbstractClockedSignalSource, BooleanClockedSignalSource, BooleanClockedSignalSourceVector, ByteClockedSignalSource, ByteClockedSignalSourceVector, ClockedSignalSource<A>, ClockedSignalSourceVector<A>, DoubleADSR, DoubleClockedSignalSource, DoubleClockedSignalSourceVector, EnumClockedSignalSource<E>, FloatADSR, FloatClockedSignalSource, FloatClockedSignalSourceVector, IntClockedSignalSource, IntClockedSignalSourceVector, LongClockedSignalSource, LongClockedSignalSourceVector
All Known Implementing Classes:
AbstractProcess, BooleanDelay, BooleanDelayVector, BooleanMultiDelay, BooleanStoredSignalSource, ByteClockedSignalSource.AbstractRandom, ByteDelay, ByteDelayVector, ByteMultiDelay, ByteProcessMux, ByteSaH, ByteStoredSignalSource, CompilableBooleanStoredSignalSource, CompilableByteStoredSignalSource, CompilableDoubleStoredSignalSource, CompilableEnumStoredSignalSource, CompilableFloatStoredSignalSource, CompilableIntStoredSignalSource, CompilableLongStoredSignalSource, CompilableStoredSignalSource, CwnSequencerDouble, CwnSequencerFloat, Delay, DelayVector, DoubleClockedSignalSource.AbstractRandom, DoubleDelay, DoubleDelayVector, DoubleEnvelope, DoubleFMOsci, DoubleFractionalDelay, DoubleLinearMap, DoubleMultiDelay, DoubleOctaveRepeatingTabledTuning, DoublePanoramaMixer, DoubleProcessMux, DoubleSaH, DoubleSequencer, DoubleStoredSignalSource, DoubleTableOscillator, DoubleUpsamplingSignalSource, DoubleVectorMap, EnumDelay, EnumStoredSignalSource, EnvelopeModifierInterpreter, FloatClockedSignalSource.AbstractRandom, FloatDelay, FloatDelayVector, FloatEnvelope, FloatFMOsci, FloatFractionalDelay, FloatLinearMap, FloatMultiDelay, FloatOctaveRepeatingTabledTuning, FloatPanoramaMixer, FloatProcessMux, FloatSaH, FloatSequencer, FloatStoredSignalSource, FloatTableOscillator, FloatUpsamplingSignalSource, FloatVectorMap, IntClockedSignalSource.AbstractRandom, IntDelay, IntDelayVector, IntMultiDelay, IntProcessMux, IntSaH, IntStoredSignalSource, LongClockedSignalSource.AbstractRandom, LongDelay, LongDelayVector, LongMultiDelay, LongStoredSignalSource, MultiDelay, NextEvent, Process.Proxy, ProcMux, SaH, Sequencer.Seq, SigSequencer, SoloMute, StoredSignalSource, SystemTime
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Process extends Component, CompilableControlFlow
Interface of computational processes that cause observable state changes at specified events in real or symbolic time.

Successive invocations of step() enumerate the sequence of observable states of this process.

Before step() may be invoked, init() should be invoked once. The state between the invocations of init() and step() should not be observed. At any time between invocations of step(), init() may be invoked again to reset the process.

Every entity that implements this interface is assumed to have internal state that conceptually represents a clock index:

  • The index is set to -1 by invocation of init().
  • Every invocation of step() increases the clock index by one.
  • Specifications that refer to the clock index are only valid for nonnegative values; in particular the behavior between invocations of init() and step() is undefined.

The clock index is possibly, but not necessarily, proportional to the amount of model time that has elapsed since initialization. The details are specified by the objects passed to the step() method.

State transitions are not assumed to be thread-safe. Invocations of init() and/or step() should not occur concurrently or reentrantly.

There is no explicit termination of the lifetime of a process. The process itself is not entitled to terminate on its own initiative. On the client side it suffices to cease invoking step().

FIXME: setRealtimeContext(eu.bandm.sig.adlib2.RealtimeContext)

  • Method Details

    • getProcess

      @Deprecated default Process getProcess()
      Deprecated.
      Description copied from interface: Component
      Returns the delegate object that effects changes of observable state.
      Specified by:
      getProcess in interface Component
    • init

      default void init()
      Initializes the state of this process. The state is initialized such that the first subsequent call to step() transitions to the first specified observable state.

      The default implementation does nothing.

    • step

      void step()
      Signals a time event, executing a transition step for this process to the next observable state.

      The state of the process after successful completion of this method should be the n-th observable state, if step() has been invoked n times since the last initialization via init(). The behavior of this method is unspecified if init() has not been invoked before.

      FIXME: setRealtimeContext(eu.bandm.sig.adlib2.RealtimeContext)

      If this method completes abruptly by throwing an error or unchecked exception, the process state should be considered invalid.

    • setRealtimeContext

      @Undocumented default void setRealtimeContext(RealtimeContext context)
    • nop

      @Undocumented static Process nop()
    • compileInitialization

      default Consumer<CompilationContext> compileInitialization()
      Compiles the initialization of this process.

      This method emits code equivalent to the init() method of this component. The compilation context should be set up to specify no input or output variables.

      The default implementation emits code that simply invokes init() for this process.

      This method should be overridden together with compileControlFlow(), in order to ensure that both operate on the same state variables.

      Specified by:
      compileInitialization in interface CompilableControlFlow
      See Also:
    • compileControlFlow

      default Consumer<CompilationContext> compileControlFlow()
      Compiles the state transition of this process.

      This method emits code equivalent to the step() method of this process. The compilation context should be set up to specify no input or output variables.

      The default implementation emits code that simply invokes step() for this process.

      This method should be overridden together with compileInitialization(), in order to ensure that both operate on the same state variables.

      Specified by:
      compileControlFlow in interface CompilableControlFlow
      See Also:
    • hasInitializationIO

      default boolean hasInitializationIO(CompilationContext context)
      Checks whether a compilation context has input/output variables set up for the compilation of an initialization.
      Parameters:
      context - the compilation context to be checked

      This method is suitable for use in an assert statement, to be run at the beginning of the compileInitialization() method.

      See Also:
    • hasControlFlowIO

      default boolean hasControlFlowIO(CompilationContext context)
      Checks whether a compilation context has input/output variables set up for the compilation of a step() method.
      Parameters:
      context - the compilation context to be checked

      This method is suitable for use in an assert statement, to be run at the beginning of the compileControlFlow() method.

      See Also:
    • compileAsMainProcess

      @Undocumented default void compileAsMainProcess(CompilationContext context)
    • andThen

      default Process andThen(Process other)
      Composes the state dynamics of this process sequentially with those of another.

      Sequential composition means that both processes will be initialized and make transitions at each of the incoming time events together, but at each step this process will observe the non-updated state of the other, whereas conversely the other will already observe the updated state of this process.

      Parameters:
      other - the other process
      Returns:
      a process that, at initialization or each time event, will execute the state initialization or transition of this process, respectively, followed by the corresponding operation of the other.
    • sequence

      static Process sequence(Process... elems)
      Composes the state dynamics of zero or more processes sequentially.

      Sequential composition means that all processes will be initialized and make transitions at each of the incoming time events together, but at each step each process will observe the non-updated state of processes occurring later in the sequence, whereas conversely it will already observe the updated state of processes occurring earlier in the sequence.

      Behavior is undefined if a process occurs more than once in the sequence.

      Parameters:
      elems - the array of processes
      Returns:
      a process that, at initialization or each time event, will execute the state initialization or transition of each process in the sequence in order.
    • sequence

      static Process sequence(List<? extends Process> elems)
      Composes the state dynamics of zero or more processes sequentially.

      Sequential composition means that all processes will be initialized and make transitions at each of the incoming time events together, but at each step each process will observe the non-updated state of processes occurring later in the sequence, whereas conversely it will already observe the updated state of processes occurring earlier in the sequence.

      Behavior is undefined if a process occurs more than once in the sequence.

      Parameters:
      elems - the list of processes
      Returns:
      a process that, at initialization or each time event, will execute the state initialization or transition of each process in the sequence in order.
    • choose

      @Undocumented static Process choose(BooleanSignalSource cond, Process ifTrue, Process ifFalse)
    • probe

      @Undocumented static Process probe(Object key)
    • every

      @Undocumented default Process every(int slowdown)
    • every

      @Undocumented default Process every(int slowdown, Optional<ConstantRealtimeContext> rc)
    • afterEvery

      @Undocumented default Process afterEvery(int delay, int slowdown, Optional<ConstantRealtimeContext> rc)
    • compile

      @Undocumented default Process compile()