Package eu.bandm.sig.adlib2
Interface EnumSignalSource<E extends Enum<E>>
- Type Parameters:
E
- theenum
type of the values of this signal source
- All Superinterfaces:
AbstractSignalSource
,CompilableDataFlow
,IntSignalSource
,IntSupplier
- All Known Subinterfaces:
EnumClockedSignalSource<E>
- All Known Implementing Classes:
CompilableEnumStoredSignalSource
,EnumDelay
,EnumSignalSourceChooser
,EnumStoredSignalSource
Interface of a signal source with
enum
values at
construction time but ordinal int
values at runtime.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault SignalSource<E>
box()
static <E extends Enum<E>>
EnumSignalSource<E>choose
(BooleanSignalSource condition, EnumSignalSource<E> inTrue, EnumSignalSource<E> inFalse) static <E extends Enum<E>,
F extends Enum<F>>
EnumSignalSource<F>choose
(EnumSignalSource<E> condition, EnumMap<E, ? extends EnumSignalSource<F>> cases) Returns a new signal source whose value is selected dynamically from a range of cases indexed byenum
values.default <A> SignalSource<A>
choose
(EnumMap<E, ? extends SignalSource<A>> cases) default BooleanSignalSource
chooseBoolean
(EnumMap<E, ? extends BooleanSignalSource> cases) default DoubleSignalSource
chooseDouble
(EnumMap<E, ? extends DoubleSignalSource> cases) default <F extends Enum<F>>
EnumSignalSource<F>chooseEnum
(EnumMap<E, ? extends EnumSignalSource<F>> cases) default FloatSignalSource
chooseFloat
(EnumMap<E, ? extends FloatSignalSource> cases) default IntSignalSource
chooseInt
(EnumMap<E, ? extends IntSignalSource> cases) default LongSignalSource
chooseLong
(EnumMap<E, ? extends LongSignalSource> cases) static <E extends Enum<E>>
EnumSignalSource<E>constant
(E value) Returns a signal source whose value is constant (never changes).static <E extends Enum<E>>
EnumSignalSource<E>of
(Class<E> enumClass, SignalSource<E> body) default EnumClockedSignalSource<E>
stored()
Returns a new signal source that stores snapshot values of this signal source driven by a clock.Methods inherited from interface eu.bandm.sig.adlib2.compile.CompilableDataFlow
compileDataFlowTo, hasDataFlowIO
Methods inherited from interface eu.bandm.sig.adlib2.IntSignalSource
abs, add, asInt, compileDataFlow, compileMainSignalSource, DEBUG, delayed, delayed, divide, equal, getAsInt, getConstantAsInt, getValueClass, greaterOrEqual, greaterThan, guard, hasConstantAsInt, invariant, lessOrEqual, lessThan, map, max, min, modulo, multiply, negate, negative, nonEqual, nonnegative, nonpositive, nonzero, positive, power, probe, publishStoredValueVariable, relateWith, sampleAndHold, subtract, zero, zipWith
-
Method Details
-
getEnumClass
-
constant
Description copied from interface:IntSignalSource
Returns a signal source whose value is constant (never changes).- Parameters:
value
- the value of the new signal source- Returns:
- a signal source that always has the given value
-
of
-
box
-
stored
Description copied from interface:IntSignalSource
Returns a new signal source that stores snapshot values of this signal source driven by a clock.The
IntSignalSource.getAsInt()
method of the returned signal source is guaranteed to be extremely fast, both in interpreted and compiled mode. The computational effort of the underlying signal source is instead spent on theProcess.step()
method of the returned signal source, to be invoked at each clock tick.If the underlying signal source is constant, the value is forwarded when the
Process.init()
method of the returned signal source is invoked, where as its implementation ofProcess.step()
does nothing.- Specified by:
stored
in interfaceIntSignalSource
- Returns:
- a new signal source that takes value snapshots of this signal source.
-
choose
-
chooseEnum
default <F extends Enum<F>> EnumSignalSource<F> chooseEnum(EnumMap<E, ? extends EnumSignalSource<F>> cases) -
chooseFloat
-
chooseDouble
-
chooseInt
-
chooseLong
-
chooseBoolean
-
choose
static <E extends Enum<E>,F extends Enum<F>> EnumSignalSource<F> choose(EnumSignalSource<E> condition, EnumMap<E, ? extends EnumSignalSource<F>> cases) Description copied from interface:IntSignalSource
Returns a new signal source whose value is selected dynamically from a range of cases indexed byenum
values.At any point in time,
choose(s, m).getAsInt() == m.get(E.values()[s.getAsInt()]).getAsInt()
holds.The given map
cases
is assumed to be immutable and to contain an entry for every possible value of theenum
typeE
.- Type Parameters:
E
- the type ofenum
values- Parameters:
condition
- the signal source that provides the ordinal number of theenum
valuecases
- a map ofenum
values to signal sources to select from
-
choose
static <E extends Enum<E>> EnumSignalSource<E> choose(BooleanSignalSource condition, EnumSignalSource<E> inTrue, EnumSignalSource<E> inFalse)
-