as2fm.jani_generator.jani_entries.jani_expression.JaniExpression
- class as2fm.jani_generator.jani_entries.jani_expression.JaniExpression(expression: str | int | float | bool | dict | list | JaniExpression | JaniValue)
Bases:
object
Jani Expression class.
Content of an instance of this class can be: - identifier: a string representing a reference to a constant or variable or - value: a JaniValue object (literal expression) or - op: a string representing an operator - operands: a dictionary of operands, related to the specified operator
- __init__(expression: str | int | float | bool | dict | list | JaniExpression | JaniValue)
Methods
__init__
(expression)as_dict
()Provide the expression as an identifier, if possible.
Provide the expression as a literal (JaniValue), if possible.
Provide the expression as an operator, if possible.
Get the type of the expression.
is_valid
()replace_event
(replacement)Replace the default SCXML event prefix with the provided replacement.
- as_identifier() str | None
Provide the expression as an identifier, if possible. None otherwise.
- as_literal() JaniValue | None
Provide the expression as a literal (JaniValue), if possible. None otherwise.
- as_operator() Tuple[str, Dict[str, JaniExpression]] | None
Provide the expression as an operator, if possible. None otherwise.
- get_expression_type() JaniExpressionType
Get the type of the expression.
- replace_event(replacement: str | None)
Replace the default SCXML event prefix with the provided replacement.
Within a transitions, scxml can access to the event’s parameters using a specific prefix. We have to replace this by the global variable where we stored the data from the received event.
- Parameters:
replacement – The string to replace PLAIN_SCXML_EVENT_DATA_PREFIX with.
- Return self:
for the convenience of chain-ability