Class JavaExprAlgorithmExecutionFactory

java.lang.Object
org.yamcs.algorithms.JavaExprAlgorithmExecutionFactory
All Implemented Interfaces:
AlgorithmExecutorFactory

public class JavaExprAlgorithmExecutionFactory extends Object implements AlgorithmExecutorFactory
Generates executors for java-expression algorithms.

Each algorithm gets a class with the following body

 class AlgorithmExecutor_algoName extends AbstractAlgorithmExecutor {
 
     AlgorithmExecutionResult execute(long acqTime, long genTime) throws AlgorithmException {
        List<ParameterValue> outputValues = new ArrayList<>();
        for(int i = 0; i < algorithmDef.getOutputList().size; i++) {
           outputValues.add(new ParameterValue());
        }
        execute_java_expr(inputValues.get(0), inputValues.get(1), ...);
     }
 
     void execute_java_expr(
         ParameterValue [input_name1],
         ParameterValue [input_name2],
         ...,
         ParameterValue [output_name1],
         ParameterValue [output_name2],
         ...
     ) throws AlgorithmException {
           [algorithm_text]
     }
 }
 
Where the input_nameX and output_nameY are the names of the inputs respectively outputs given in the algorithm definition and the algorithm_text is the text given in the algorithm definition.

The types of the inputs and outputs are ParameterValue

The output parameter generation time are initialised with the generation time of the parameter that triggered the algorithm but can be changed in the algorithm text.