Class Delay<A>

Type Parameters:
A - the type of values produced by this signal source
All Implemented Interfaces:
AbstractClockedSignalSource, AbstractSignalSource, ClockedSignalSource<A>, Component, Process, Register, SignalSource<A>, Supplier<A>

public class Delay<A> extends StoredSignalSource<A> implements Register
A component that forwards the value from an input signal source delayed by a single clock tick.
  • Constructor Details

    • Delay

      public Delay(Class<? super A> valueClass, A initial)
      Creates a new instance without a valid input source.

      The method setInput(SignalSource) must be invoked before this signal source can be used.

      Parameters:
      valueClass - the type of the value produced by this signal source
      initial - the initial value of this signal source
    • Delay

      public Delay(Class<? super A> valueClass, A initial, SignalSource<A> in)
      Creates a new instance with an independent input source.
      Parameters:
      valueClass - the type of the value produced by this signal source
      initial - the initial value of this signal source
      in - the input signal source
    • Delay

      public Delay(Class<? super A> valueClass, A initial, Function<? super Delay<A>,? extends SignalSource<A>> in)
      Creates a new instance with a feedback-looped input source.

      A reference to the new delay signal source d under construction is passed to the function object in in order to create the feedback loop. This reference may only be used by passing to other signal source constructions. Behavior is unspecified if any behavioral method is invoked on d before in.apply(d) has returned.

      Parameters:
      valueClass - the type of the value produced by this signal source
      initial - the initial value of this signal source
      in - a function that constructs the input signal source when applied to this delayed signal source
  • Method Details

    • setInput

      public void setInput(SignalSource<A> in)
    • getLoadPhase

      public Process getLoadPhase()
      Returns the load phase of this register.
      Specified by:
      getLoadPhase in interface Register
      Returns:
      the load phase of this register
    • getStorePhase

      public Process getStorePhase()
      Returns the store phase of this register.
      Specified by:
      getStorePhase in interface Register
      Returns:
      the store phase of this register
    • init

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

      The default implementation does nothing.

      Specified by:
      init in interface Process
      Specified by:
      init in interface Register
    • step

      public 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 Process.step() has been invoked n times since the last initialization via Process.init(). The behavior of this method is unspecified if Process.init() has not been invoked before.

      FIXME: Process.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.

      Specified by:
      step in interface Process
      Specified by:
      step in interface Register
    • getNextValue

      public A getNextValue()
      Returns the value that will be produced on the next clock tick.

      This method is in concurrent reader–writer conflict with the getStorePhase() process.

    • setNextValue

      public void setNextValue(A next)
      Sets the value that will be produced on the next clock tick.

      This method is in concurrent writer–writer conflict with the getStorePhase() process.