Class LongDelay
- All Implemented Interfaces:
AbstractClockedSignalSource
,AbstractSignalSource
,CompilableControlFlow
,CompilableDataFlow
,Component
,LongClockedSignalSource
,LongSignalSource
,Process
,Register
,LongSupplier
-
Nested Class Summary
Nested classes/interfaces inherited from interface eu.bandm.sig.adlib2.LongClockedSignalSource
LongClockedSignalSource.AbstractRandom
Nested classes/interfaces inherited from interface eu.bandm.sig.adlib2.Process
Process.Proxy
-
Field Summary
Fields inherited from class eu.bandm.sig.adlib2.LongStoredSignalSource
out
Fields inherited from interface eu.bandm.sig.adlib2.AbstractClockedSignalSource
STREAM_CHARACTERISTICS, STREAM_SIZE
-
Constructor Summary
ConstructorDescriptionLongDelay
(long initial) Creates a new instance without a valid input source.LongDelay
(long initial, LongSignalSource in) Creates a new instance with an independent input source.LongDelay
(long initial, Function<? super LongDelay, ? extends LongSignalSource> in) Creates a new instance with a feedback-looped input source. -
Method Summary
Modifier and TypeMethodDescriptionCompiles the state transition of this process.Returns a code generator for loading the next value of the compiled version of this component on the operand stack.Compiles the initialization of this process.Returns a code generator for storing the next value of the compiled version of this component from the operand stack.long
Returns the value that will be produced on the next clock tick.protected VariableContext.Variable
getNextVariable
(CompilationContext context) void
init()
Initializes the state of this process.void
void
setNextValue
(long next) Sets the value that will be produced on the next clock tick.void
step()
Signals a time event, executing a transition step for this process to the next observable state.Methods inherited from class eu.bandm.sig.adlib2.compile.CompilableLongStoredSignalSource
compileDataFlow, compileSetStoredValueVariable, getStoredValueVariable, publishStoredValueVariable
Methods inherited from class eu.bandm.sig.adlib2.LongStoredSignalSource
getAsLong
Methods inherited from class eu.bandm.sig.adlib2.AbstractProcess
getRealtimeContext, setRealtimeContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface eu.bandm.sig.adlib2.compile.CompilableDataFlow
compileDataFlowTo, hasDataFlowIO
Methods inherited from interface eu.bandm.sig.adlib2.LongClockedSignalSource
after, compile, during, spliterator, stream
Methods inherited from interface eu.bandm.sig.adlib2.LongSignalSource
abs, add, asInt, compileMainSignalSource, DEBUG, delayed, delayed, divide, equal, getConstantAsLong, getValueClass, greaterOrEqual, greaterThan, guard, hasConstantAsLong, invariant, lessOrEqual, lessThan, map, max, min, modulo, multiply, negate, negative, nonEqual, nonnegative, nonpositive, nonzero, positive, power, probe, relateWith, sampleAndHold, stored, subtract, zero, zipWith
Methods inherited from interface eu.bandm.sig.adlib2.Process
afterEvery, andThen, compileAsMainProcess, every, every, getProcess, hasControlFlowIO, hasInitializationIO, setRealtimeContext
Methods inherited from interface eu.bandm.sig.adlib2.Register
andMeanwhile, andMeanwhile
-
Constructor Details
-
LongDelay
public LongDelay(long initial) Creates a new instance without a valid input source. The methodsetInput(eu.bandm.sig.adlib2.LongSignalSource)
must be invoked before this signal source can be used.- Parameters:
initial
- the initial value of this signal source
-
LongDelay
Creates a new instance with an independent input source.- Parameters:
initial
- the initial value of this signal sourcein
- the input signal source
-
LongDelay
Creates a new instance with a feedback-looped input source.- Parameters:
initial
- the initial value of this signal sourcein
- a function that constructs the input signal source when applied to this delayed signal source
-
-
Method Details
-
setInput
-
getLoadPhase
- Specified by:
getLoadPhase
in interfaceRegister
-
getStorePhase
- Specified by:
getStorePhase
in interfaceRegister
-
init
public void init()Description copied from interface:Process
Initializes the state of this process. The state is initialized such that the first subsequent call toProcess.step()
transitions to the first specified observable state.The default implementation does nothing.
-
step
public void step()Description copied from interface:Process
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 viaProcess.init()
. The behavior of this method is unspecified ifProcess.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.
-
getNextVariable
-
compileInitialization
Description copied from interface:Process
Compiles the initialization of this process.This method emits code equivalent to the
Process.init()
method of this component. The compilation context should be set up to specify no input or output variables.The default implementation emits code that simply invokes
Process.init()
for this process.This method should be overridden together with
Process.compileControlFlow()
, in order to ensure that both operate on the same state variables.- Specified by:
compileInitialization
in interfaceCompilableControlFlow
- Specified by:
compileInitialization
in interfaceProcess
- Overrides:
compileInitialization
in classCompilableLongStoredSignalSource
- See Also:
-
compileControlFlow
Description copied from interface:Process
Compiles the state transition of this process.This method emits code equivalent to the
Process.step()
method of this process. The compilation context should be set up to specify no input or output variables.The default implementation emits code that simply invokes
Process.step()
for this process.This method should be overridden together with
Process.compileInitialization()
, in order to ensure that both operate on the same state variables.- Specified by:
compileControlFlow
in interfaceCompilableControlFlow
- Specified by:
compileControlFlow
in interfaceProcess
- Specified by:
compileControlFlow
in classCompilableLongStoredSignalSource
- See Also:
-
getNextValue
public long 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. -
compileGetNextValue
Returns a code generator for loading the next value of the compiled version of this component on the operand stack.- See Also:
-
setNextValue
public void setNextValue(long 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. -
compileSetNextValue
Returns a code generator for storing the next value of the compiled version of this component from the operand stack.- See Also:
-