Package org.yamcs.scos2k.ol
Class BaseOLParser
java.lang.Object
org.yamcs.scos2k.ol.BaseOLParser
- Direct Known Subclasses:
OLParser
Transforms OL Formulas into java classes.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddVariable(String name, org.yamcs.scos2k.ol.Type type) voidgenerateCode(String name, StringBuilder sb, Function<String, ParameterType> inputParameterTypes) Appends the class definition to the StringBuilder (which needs to have on top the package and import declaration).static voidGenerates the import statement required before the class definitiongenerateCodeStandalone(String name, Function<String, ParameterType> inputParameterTypes) Generate code that can be used in a java compilation unitstatic Yamcs.Value.TypegetEngType(ParameterType ptype) protected ExpressionCodeprotected Stringprotected ExpressionCodegetSynthExpression(List<String> paraList) protected booleanisGlobalVar(String id) protected booleanisLocalVar(String id) booleanisNoTrigger(String pname) protected abstract voidparse(StringBuilder body) static longparseAdsTime(String timeString) Parses the ADS format: yyyy.ddd.hh.mm.ss[mmm] into millisecondsstatic longparseAsciiATime(String timeString) Parses the format yyyy-mm-ddThh:mm:ss.static longparseAsciiBTime(String timeString) Parses the format yyyy-dddThh:mm:ss.static longparseDeltaTime(String timeString) Parses the format ddd.hh.mm.ss[mmm] into milliseconds
-
Field Details
-
body
-
-
Constructor Details
-
BaseOLParser
public BaseOLParser()
-
-
Method Details
-
generateCodeImports
Generates the import statement required before the class definition- Parameters:
code-
-
generateCodeStandalone
public String generateCodeStandalone(String name, Function<String, ParameterType> inputParameterTypes) throws ParseExceptionGenerate code that can be used in a java compilation unit- Parameters:
name- - the name of the output parameterinputParameterTypes- - function that gives the types for the input parameters; the function should return null if the parameter is unknown (a ParseException will be thrown in this case).- Returns:
- a piece of java code ready to be compiled
- Throws:
ParseException
-
generateCode
public void generateCode(String name, StringBuilder sb, Function<String, ParameterType> inputParameterTypes) throws ParseExceptionAppends the class definition to the StringBuilder (which needs to have on top the package and import declaration). Can be used to generate multiple classes in the same unit.- Parameters:
name-sb-- Throws:
ParseException
-
getReturnCode
-
addVariable
- Throws:
ParseException
-
getIdentifierCode
- Throws:
ParseException
-
isGlobalVar
-
isLocalVar
-
getSynthExpression
-
parse
- Throws:
ParseException
-
isNoTrigger
-
getInputParameters
-
parseDeltaTime
Parses the format ddd.hh.mm.ss[mmm] into milliseconds- Throws:
ParseException
-
parseAdsTime
Parses the ADS format: yyyy.ddd.hh.mm.ss[mmm] into milliseconds- Throws:
ParseException
-
parseAsciiATime
Parses the format yyyy-mm-ddThh:mm:ss.[uuuuuuu] into milliseconds- Throws:
ParseException
-
parseAsciiBTime
Parses the format yyyy-dddThh:mm:ss.[uuuuuu] into milliseconds- Throws:
ParseException
-
getEngType
-