Class StoredSignalSource<A>

java.lang.Object
eu.bandm.sig.adlib2.AbstractProcess
eu.bandm.sig.adlib2.StoredSignalSource<A>
Type Parameters:
A - the type of values produced by this signal source
All Implemented Interfaces:
AbstractClockedSignalSource, AbstractSignalSource, ClockedSignalSource<A>, CompilableControlFlow, CompilableDataFlow, Component, Process, SignalSource<A>, Supplier<A>
Direct Known Subclasses:
CompilableStoredSignalSource, SaH

public abstract class StoredSignalSource<A> extends AbstractProcess implements ClockedSignalSource<A>
Common base class for signal (time-dependent value) sources of a fixed object type whose output is the value of a variable that is updated only as driven by a clock.

The current value is stored in the field out, which needs to be written by the method Process.step().

  • Field Details

    • valueClass

      protected final Class<? super A> valueClass
      The type of values produced by this signal source.
    • out

      protected A out
      The stored value of this signal source.
  • Constructor Details

    • StoredSignalSource

      protected StoredSignalSource(Optional<ConstantRealtimeContext> realtimeContext, Class<? super A> valueClass)
    • StoredSignalSource

      public StoredSignalSource(Class<? super A> valueClass)
      Creates a new instance.
      Parameters:
      valueClass - the type of values produced by this signal source
  • Method Details

    • getValueClass

      public Class<? super A> getValueClass()
      Returns the type of values produced by this entity.

      For signals of primitive value type, the result will be the corresponding pseudoclass.

      This implementation returns Object.class. Subclasses may override this method to provide more specific type information.

      Specified by:
      getValueClass in interface CompilableDataFlow
      Specified by:
      getValueClass in interface SignalSource<A>
      Returns:
      the type of signal values that this entity produces
      See Also:
    • get

      public final A get()
      Returns the current value of this signal source.

      The value may be either computed on demand, or retrieved from storage.

      Implementations of this method should have no side effect.

      Specified by:
      get in interface SignalSource<A>
      Specified by:
      get in interface Supplier<A>
      Returns:
      the current value of out