Package org.yamcs.algorithms
Class AbstractAlgorithmExecutor
- java.lang.Object
-
- org.yamcs.algorithms.AbstractAlgorithmExecutor
-
- All Implemented Interfaces:
AlgorithmExecutor
- Direct Known Subclasses:
MathAlgorithmExecutor
,ScriptAlgorithmExecutor
public abstract class AbstractAlgorithmExecutor extends Object implements AlgorithmExecutor
Skeleton implementation for algorithms conforming to the XTCEAlgorithm
definition. - it collects all the inputs into an inputList and implements the triggering based on the mandatory parameters.
-
-
Field Summary
Fields Modifier and Type Field Description protected Algorithm
algorithmDef
protected AlgorithmExecutionContext
execCtx
protected CopyOnWriteArrayList<AlgorithmExecListener>
execListeners
protected List<ParameterValue>
inputValues
protected static org.slf4j.Logger
log
-
Constructor Summary
Constructors Constructor Description AbstractAlgorithmExecutor(Algorithm algorithmDef, AlgorithmExecutionContext execCtx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExecListener(AlgorithmExecListener listener)
Algorithm
getAlgorithm()
AlgorithmExecutionContext
getExecutionContext()
int
getLookbackSize(Parameter parameter)
protected void
propagateToListeners(Object returnValue, List<ParameterValue> outputValues)
protected void
updateInput(int idx, InputParameter inputParameter, ParameterValue newValue)
Called when the given inputParameter receives a value. idx is the index of the inputParameter in the algorithm definition input list Note that all values are also collected in the inputListboolean
updateParameters(List<ParameterValue> items)
update the parameters and return true if the algorithm should run-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.yamcs.algorithms.AlgorithmExecutor
runAlgorithm
-
-
-
-
Field Detail
-
execCtx
protected final AlgorithmExecutionContext execCtx
-
algorithmDef
protected final Algorithm algorithmDef
-
execListeners
protected final CopyOnWriteArrayList<AlgorithmExecListener> execListeners
-
log
protected static final org.slf4j.Logger log
-
inputValues
protected final List<ParameterValue> inputValues
-
-
Constructor Detail
-
AbstractAlgorithmExecutor
public AbstractAlgorithmExecutor(Algorithm algorithmDef, AlgorithmExecutionContext execCtx)
-
-
Method Detail
-
updateParameters
public boolean updateParameters(List<ParameterValue> items)
update the parameters and return true if the algorithm should run- Specified by:
updateParameters
in interfaceAlgorithmExecutor
- Parameters:
items
-- Returns:
- true if the algorithm should run
-
updateInput
protected void updateInput(int idx, InputParameter inputParameter, ParameterValue newValue)
Called when the given inputParameter receives a value. idx is the index of the inputParameter in the algorithm definition input list Note that all values are also collected in the inputList- Parameters:
inputParameter
-newValue
-
-
propagateToListeners
protected void propagateToListeners(Object returnValue, List<ParameterValue> outputValues)
-
addExecListener
public void addExecListener(AlgorithmExecListener listener)
- Specified by:
addExecListener
in interfaceAlgorithmExecutor
-
getExecutionContext
public AlgorithmExecutionContext getExecutionContext()
- Specified by:
getExecutionContext
in interfaceAlgorithmExecutor
-
getLookbackSize
public int getLookbackSize(Parameter parameter)
- Specified by:
getLookbackSize
in interfaceAlgorithmExecutor
-
getAlgorithm
public Algorithm getAlgorithm()
- Specified by:
getAlgorithm
in interfaceAlgorithmExecutor
-
-