java.lang.Object
org.yamcs.algorithms.JavaExprAlgorithmExecutionFactory
- All Implemented Interfaces:
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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgenerateClassCode(String className, org.yamcs.xtce.CustomAlgorithm algorithmDef) Returns all the languages supported by this factory.makeExecutor(org.yamcs.xtce.CustomAlgorithm alg, AlgorithmExecutionContext execCtx) Creates a new executor for the algorithm running in the execution context
-
Constructor Details
-
JavaExprAlgorithmExecutionFactory
public JavaExprAlgorithmExecutionFactory()
-
-
Method Details
-
makeExecutor
public AlgorithmExecutor makeExecutor(org.yamcs.xtce.CustomAlgorithm alg, AlgorithmExecutionContext execCtx) throws AlgorithmException Description copied from interface:AlgorithmExecutorFactoryCreates a new executor for the algorithm running in the execution context- Specified by:
makeExecutorin interfaceAlgorithmExecutorFactory- Parameters:
alg- - the algorithm definitionexecCtx- - the algorithm execution context- Returns:
- Throws:
AlgorithmException
-
getLanguages
Description copied from interface:AlgorithmExecutorFactoryReturns all the languages supported by this factory. Used in order to not create new factories for the same language with different names (e.g. JavaScript and ECMAScript)- Specified by:
getLanguagesin interfaceAlgorithmExecutorFactory- Returns:
-
generateClassCode
-