Package org.yamcs.algorithms
Class ScriptAlgorithmExecutor
- java.lang.Object
-
- org.yamcs.algorithms.AbstractAlgorithmExecutor
-
- org.yamcs.algorithms.ScriptAlgorithmExecutor
-
- All Implemented Interfaces:
AlgorithmExecutor
public class ScriptAlgorithmExecutor extends AbstractAlgorithmExecutor
Represents the execution context of one algorithm. An AlgorithmExecutor is reused upon each update of one or more of its InputParameters.This class will create and compile on-the-fly ValueBinding implementations for every unique combination of raw and eng types.
-
-
Field Summary
-
Fields inherited from class org.yamcs.algorithms.AbstractAlgorithmExecutor
algorithmDef, execCtx, inputValues
-
-
Constructor Summary
Constructors Constructor Description ScriptAlgorithmExecutor(CustomAlgorithm algorithmDef, Invocable invocable, String functionName, String functionScript, AlgorithmExecutionContext execCtx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AlgorithmExecutionResult
execute(long acqTime, long genTime, ProcessingData data)
Runs the associated algorithm with the latest InputParameters.String
toString()
protected void
updateInput(int position, 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.protected void
updateInputArgument(int position, InputParameter inputParameter, ArgumentValue newValue)
Called when the given inputParameter which contains a reference to an argument receives an argument value.-
Methods inherited from class org.yamcs.algorithms.AbstractAlgorithmExecutor
getAlgorithm, getExecutionContext, getInputArgument, getInputParameter, getOutputParameter, update
-
-
-
-
Constructor Detail
-
ScriptAlgorithmExecutor
public ScriptAlgorithmExecutor(CustomAlgorithm algorithmDef, Invocable invocable, String functionName, String functionScript, AlgorithmExecutionContext execCtx)
-
-
Method Detail
-
updateInput
protected void updateInput(int position, InputParameter inputParameter, ParameterValue newValue)
Description copied from class:AbstractAlgorithmExecutor
Called when the given inputParameter receives a value. idx is the index of the inputParameter in the algorithm definition input list.newValue can be either a
ParameterValue
or aArgumentValue
Can be used by subclasses to perform specific actions;
Note that all values are also collected in the inputList
- Overrides:
updateInput
in classAbstractAlgorithmExecutor
-
updateInputArgument
protected void updateInputArgument(int position, InputParameter inputParameter, ArgumentValue newValue)
Description copied from class:AbstractAlgorithmExecutor
Called when the given inputParameter which contains a reference to an argument receives an argument value.idx is the index of the inputParameter in the algorithm.
- Overrides:
updateInputArgument
in classAbstractAlgorithmExecutor
-
execute
public AlgorithmExecutionResult execute(long acqTime, long genTime, ProcessingData data)
Description copied from interface:AlgorithmExecutor
Runs the associated algorithm with the latest InputParameters.Should throw an exception if there is an error within the algorithm.
The error message and error count will be remembered and available to external clients via the API.
The processing data parameter is passed if required to calibrate the output values. It shall not be updated by the executor as it is done in the
ActiveAlgorithm
- Returns:
- the output parameters, if any
-
-