Package org.yamcs.studio.data
Class FunctionParser
java.lang.Object
org.yamcs.studio.data.FunctionParser
Utility class to parse variable names and create simulated signals.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ListDouble
asListDouble
(List<Object> objects) Convert the list of arguments to a ListDouble.asListString
(List<Object> objects) Convert the list of arguments to a List.static Object
asScalarOrList
(List<Object> objects) Converts the list of arguments into a scalar or an appropriate list.parseFunctionAnyParameter
(String string) Parses the string and returns the name of the function plus the list of arguments.parseFunctionAnyParameter
(String nameRegex, String string) Parses the string and returns the name of the function plus the list of arguments.parseFunctionWithScalarOrArrayArguments
(String string, String errorMessage) Parse a function that accepts a scalar value (number or string) or an array value (number or string).parseFunctionWithScalarOrArrayArguments
(String nameRegex, String string, String errorMessage) Parse a function that accepts a scalar value (number or string) or an array value (number or string).
-
Field Details
-
STRING_ESCAPE_SEQUENCE_REGEX
The pattern of a string fragment with escape sequences.- See Also:
-
QUOTED_STRING_REGEX
The pattern of a string, including double quotes.- See Also:
-
DOUBLE_REGEX
The pattern of a double value.- See Also:
-
-
Constructor Details
-
FunctionParser
public FunctionParser()
-
-
Method Details
-
parseFunctionWithScalarOrArrayArguments
public static List<Object> parseFunctionWithScalarOrArrayArguments(String string, String errorMessage) Parse a function that accepts a scalar value (number or string) or an array value (number or string).- Parameters:
string
- the string to be parsederrorMessage
- the error message- Returns:
- the name of the function and the argument
-
parseFunctionWithScalarOrArrayArguments
public static List<Object> parseFunctionWithScalarOrArrayArguments(String nameRegex, String string, String errorMessage) Parse a function that accepts a scalar value (number or string) or an array value (number or string).- Parameters:
nameRegex
- regex for function namestring
- the string to be parsederrorMessage
- the error message for the exception if parsing fails- Returns:
- the name of the function and the argument
-
asScalarOrList
Converts the list of arguments into a scalar or an appropriate list. Returns null if it's not possible.- Parameters:
objects
- the argument list- Returns:
- the value converted or null
-
asListDouble
Convert the list of arguments to a ListDouble. Returns null if it's not possible.- Parameters:
objects
- a list of arguments- Returns:
- the converted list or null
-
asListString
Convert the list of arguments to a List. Returns null if it's not possible.- Parameters:
objects
- a list of arguments- Returns:
- the converted list of null
-
parseFunctionAnyParameter
Parses the string and returns the name of the function plus the list of arguments. The arguments can either be doubles or Strings. Returns null if parsing fails.- Parameters:
string
- the string to be parsed- Returns:
- the function name and arguments; null if parsing fails
-
parseFunctionAnyParameter
Parses the string and returns the name of the function plus the list of arguments. The arguments can either be doubles or Strings. Returns null if parsing fails.- Parameters:
nameRegex
- the syntax for the function namestring
- the string to be parsed- Returns:
- the function name and arguments; null if parsing fails
-