public interface DoubleClockedSignalSource extends DoubleSignalSource, AbstractClockedSignalSource
double
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 = ...; DoubleClockedSignalSource c = ...; c.init(); while (...) { c.step(rc); double v = c.getAsDouble(); ... }
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.
Process
Modifier and Type | Interface and Description |
---|---|
static class |
DoubleClockedSignalSource.AbstractRandom |
Process.Proxy
STREAM_CHARACTERISTICS, STREAM_SIZE
Modifier and Type | Method and Description |
---|---|
static DoubleClockedSignalSource |
adHoc(double... elems)
Returns a new signal source that produces the given values, one per clock tick.
|
default DoubleClockedSignalSource |
after(Process... slaves) |
static DoubleClockedSignalSource |
clock(Optional<ConstantRealtimeContext> context)
Returns a signal source that displays how much model time has passed since
the first clock tick.
|
default DoubleClockedSignalSource |
compile()
Returns a new signal source that realizes the same behavior as this signal
source with specialized code.
|
static DoubleClockedSignalSource |
cycle(double... elems)
Returns a new signal source that produces the given values repeatedly, one
per clock tick.
|
static DoubleClockedSignalSource |
dt(Optional<ConstantRealtimeContext> rc)
Returns a new signal source whose value is the amount of model time that
is projected to elapse between the current and the next clock tick.
|
default DoubleClockedSignalSource |
during(Register outer) |
static DoubleClockedSignalSource |
ofSpliterator(Supplier<? extends Spliterator.OfDouble> spliterator,
DoubleSupplier afterwards) |
static DoubleClockedSignalSource |
ofStream(Supplier<? extends DoubleStream> stream) |
static DoubleClockedSignalSource |
ofStream(Supplier<? extends DoubleStream> stream,
DoubleSupplier afterwards) |
static DoubleClockedSignalSource |
random() |
static DoubleClockedSignalSource |
random(long seed) |
static DoubleClockedSignalSource |
random(OptionalLong seed) |
static DoubleClockedSignalSource |
randomGaussian() |
static DoubleClockedSignalSource |
randomGaussian(long seed) |
static DoubleClockedSignalSource |
randomGaussian(OptionalLong seed) |
static DoubleClockedSignalSource |
rate(Optional<ConstantRealtimeContext> rc)
Returns a new signal source whose value is the reciprocal of amount of
model time that is projected to elapse between the current and the next clock
tick.
|
default Spliterator.OfDouble |
spliterator(Supplier<? extends RealtimeContext> context) |
default DoubleStream |
stream(Supplier<? extends RealtimeContext> context) |
abs, add, choose, choose, choose, choose, clock, compileDataFlow, compileMainSignalSource, constant, defined, delayed, delayed, delayedFeedback, delayedFeedback, divide, equal, getAsDouble, getConstantAsDouble, getValueClass, glidingAverage, glidingStandardDeviation, glidingSum, glidingVariance, greaterOrEqual, greaterThan, guard, hasConstantAsDouble, invariant, lessOrEqual, lessThan, map, max, min, modulo, multiply, negate, negative, nonEqual, nonnegative, nonpositive, nonzero, notANumber, positive, power, probe, publishStoredValueVariable, relateWith, sampleAndHold, selectAffine, series, sqrt, stored, subtract, zero, zeroCrossing, zipWith
compileDataFlowTo, hasDataFlowIO
afterEvery, andThen, compileAsMainProcess, compileControlFlow, compileInitialization, every, getProcess, hasControlFlowIO, hasInitializationIO, init, probe, sequence, sequence, step
default DoubleClockedSignalSource after(Process... slaves)
default DoubleClockedSignalSource during(Register outer)
@SafeVarargs static DoubleClockedSignalSource adHoc(double... elems)
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.getAsDouble() == (n <
elems.length ? elems[n] : 0d)
holds.
elems
- the array of values to produce@SafeVarargs static DoubleClockedSignalSource cycle(double... elems)
When the given values are exhausted the iteration starts over.
At clock index n
, this.getAsDouble() == elems[n %
elems.length]
holds.
elems
- the array of values to producedefault DoubleClockedSignalSource compile()
The resulting object displays the same long-term behavior (reaction with output values to realtime events) as this signal source. Its internal state is undefined phase until initialized properly.
Specialized JVM byte code is generated, and a new class is loaded for the implementation. It can be expected to execute more efficiently than the original after a warm-up phase, subject to the usual conditions of JVM just-in-time compilation. Hence compilation is recommended for components to be used in tight long-running loops, but not for one-off or infrequent computations.
The original and the compiled instance do not share state phase or memory; their life cycles are independent except for shared non-compilable components. For the latter reason, it is recommended not to use both instances concurrently.
default DoubleStream stream(Supplier<? extends RealtimeContext> context)
default Spliterator.OfDouble spliterator(Supplier<? extends RealtimeContext> context)
static DoubleClockedSignalSource ofStream(Supplier<? extends DoubleStream> stream)
static DoubleClockedSignalSource ofStream(Supplier<? extends DoubleStream> stream, DoubleSupplier afterwards)
static DoubleClockedSignalSource ofSpliterator(Supplier<? extends Spliterator.OfDouble> spliterator, DoubleSupplier afterwards)
static DoubleClockedSignalSource dt(Optional<ConstantRealtimeContext> rc)
static DoubleClockedSignalSource rate(Optional<ConstantRealtimeContext> rc)
RealtimeContext#getSamplingRate{assuffix}()
static DoubleClockedSignalSource clock(Optional<ConstantRealtimeContext> context)
Initialization resets the value to zero.
@Undocumented static DoubleClockedSignalSource random(long seed)
@Undocumented static DoubleClockedSignalSource random()
@Undocumented static DoubleClockedSignalSource random(OptionalLong seed)
@Undocumented static DoubleClockedSignalSource randomGaussian(long seed)
@Undocumented static DoubleClockedSignalSource randomGaussian()
@Undocumented static DoubleClockedSignalSource randomGaussian(OptionalLong seed)