Interface ClockedSignalSource<A>

Type Parameters:
A - the type of values produced by this signal source
All Superinterfaces:
AbstractClockedSignalSource, AbstractSignalSource, Component, Process, SignalSource<A>, Supplier<A>
All Known Implementing Classes:
Delay, MultiDelay, SaH, StoredSignalSource

@Generated(generator="eu.bandm.tools.expander", version="1.3.1", timestamp="2026-10-23T14:02:06") public interface ClockedSignalSource<A> extends SignalSource<A>, AbstractClockedSignalSource
Interface of a signal source of a fixed object type whose observable state is driven by a clock.

This interface excludes signal sources whose state changes asynchronously, but is neutral with respect to whether values are computed on the fly when demanded, or stored when available and then just retrieved.

The operation of the driving clock works as specified by the Process superinterface. For example, a main loop may use the following pattern:

 RealtimeContext rc = ...;
 ClockedSignalSource<A> c = ...;
 c.setRealtimeContext(rc);
 c.init();
 while (...) {
   c.step();
   A v = c.get();
   ...
 }
 

Every iteration of the main loop increases the clock index of the component c. The behavior of instances of this interface is typically specified in terms of the current clock index.

See Also:
  • Method Details

    • after

      default ClockedSignalSource<A> after(Process... slaves)
    • during

      default ClockedSignalSource<A> during(Register outer)
    • adHoc

      @SafeVarargs static <A> ClockedSignalSource<A> adHoc(Class<? super A> valueClass, A... elems)
      Returns a new signal source that produces the given values, one per clock tick.

      After the given values are exhausted, that is after as many clock ticks as there are elements in the array, the default value of the element type is held indefinitely.

      At clock index n, this.get() == (n < elems.length ? elems[n] : null) holds.

      Type Parameters:
      A - the type of values produced by this signal source
      Parameters:
      elems - the array of values to produce
    • cycle

      @SafeVarargs static <A> ClockedSignalSource<A> cycle(Class<? super A> valueClass, A... elems)
      Returns a new signal source that produces the given values repeatedly, one per clock tick.

      When the given values are exhausted the iteration starts over.

      At clock index n, this.get() == elems[n % elems.length] holds.

      Type Parameters:
      A - the type of values produced by this signal source
      Parameters:
      elems - the array of values to produce
    • stream

      @Undocumented default Stream<A> stream()
    • spliterator

      @Undocumented default Spliterator<A> spliterator()
    • ofStream

      @Undocumented static <A> ClockedSignalSource<A> ofStream(Class<A> valueClass, Supplier<? extends Stream<A>> stream)
    • ofStream

      @Undocumented static <A> ClockedSignalSource<A> ofStream(Class<A> valueClass, Supplier<? extends Stream<A>> stream, Supplier<? extends A> afterwards)
    • ofSpliterator

      @Undocumented static <A> ClockedSignalSource<A> ofSpliterator(Class<A> valueClass, Supplier<? extends Spliterator<A>> spliterator, Supplier<? extends A> afterwards)
    • drain

      default void drain(RealtimeContext rc, A[] buffer)
      Write elements from this signal source to a buffer.

      Invoking this method as drain(rc, b) is equivalent to invoking drain(rc, b, 0, b.length).

      Parameters:
      rc - the realtime context
      buffer - the buffer to write to
      See Also:
    • drain

      default void drain(RealtimeContext rc, A[] buffer, int offset, int length)
      Write elements from this signal source to a buffer.

      This method first invokes Process.setRealtimeContext(RealtimeContext) and Process.init() to put this signal source in a deterministic initial state. Then it iterates Process.step() and SignalSource.get() in turn to obtain successive values to write into the buffer.

      Invalid uses that would cause write access outside the bounds of the buffer are detected late; all preceding valid effects occur before an exception is thrown.

      Parameters:
      rc - the realtime context
      buffer - the buffer to write to
      offset - the first index to write to
      length - the number of values to write
      Throws:
      NullPointerException - is buffer is null
      IllegalArgumentException - if length is negative
      ArrayIndexOutOfBoundsException - if offset < 0 or offset + length > buffer.length