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 XTCEAlgorithmdefinition. - 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 AlgorithmalgorithmDefprotected AlgorithmExecutionContextexecCtxprotected CopyOnWriteArrayList<AlgorithmExecListener>execListenersprotected List<ParameterValue>inputValuesprotected static org.slf4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description AbstractAlgorithmExecutor(Algorithm algorithmDef, AlgorithmExecutionContext execCtx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExecListener(AlgorithmExecListener listener)AlgorithmgetAlgorithm()AlgorithmExecutionContextgetExecutionContext()intgetLookbackSize(Parameter parameter)protected voidpropagateToListeners(Object returnValue, List<ParameterValue> outputValues)protected voidupdateInput(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 inputListbooleanupdateParameters(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:
updateParametersin 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:
addExecListenerin interfaceAlgorithmExecutor
-
getExecutionContext
public AlgorithmExecutionContext getExecutionContext()
- Specified by:
getExecutionContextin interfaceAlgorithmExecutor
-
getLookbackSize
public int getLookbackSize(Parameter parameter)
- Specified by:
getLookbackSizein interfaceAlgorithmExecutor
-
getAlgorithm
public Algorithm getAlgorithm()
- Specified by:
getAlgorithmin interfaceAlgorithmExecutor
-
-