as2fm.jani_generator.jani_entries.jani_variable.JaniVariable

class as2fm.jani_generator.jani_entries.jani_variable.JaniVariable(v_name: str, v_type: Type[bool | int | float | MutableSequence], init_value: JaniExpression | JaniValue | str | int | float | bool | dict | None = None, v_transient: bool = False, array_info: ArrayInfo | None = None)

Bases: object

__init__(v_name: str, v_type: Type[bool | int | float | MutableSequence], init_value: JaniExpression | JaniValue | str | int | float | bool | dict | None = None, v_transient: bool = False, array_info: ArrayInfo | None = None)

Methods

__init__(v_name, v_type[, init_value, ...])

array_to_jany_type(array_type, n_dimensions)

Generate the type of a n-dimensional array

as_dict()

Return the variable as a dictionary.

from_dict(variable_dict)

get_array_info()

Return the array info associated to this JANI variable.

get_init_expr()

Get initial expression.

get_type()

Get type.

name()

Get name.

python_type_from_json(json_type)

Translate a (Jani) type string or dict to a Python type.

python_type_to_json(v_type, v_array_info)

Translate a Python type to the name of the type in Jani.

static array_to_jany_type(array_type: str, n_dimensions: int) dict

Generate the type of a n-dimensional array

as_dict()

Return the variable as a dictionary.

get_array_info() ArrayInfo | None

Return the array info associated to this JANI variable.

get_init_expr() JaniExpression | None

Get initial expression. if available. None otherwise.

get_type() Type[bool | int | float | MutableSequence]

Get type.

name()

Get name.

static python_type_from_json(json_type: str | dict) Tuple[Type[bool | int | float | MutableSequence], ArrayInfo | None]

Translate a (Jani) type string or dict to a Python type.

static python_type_to_json(v_type: Type[bool | int | float | MutableSequence], v_array_info: ArrayInfo | None) str | dict

Translate a Python type to the name of the type in Jani.

// Types // We cover only the most basic types at the moment. // In the remainder of the specification, all requirements like “y must be of type x” are // to be interpreted as “type x must be assignable from y’s type”. var BasicType = schema([ “bool”, // assignable from bool “int”, // numeric; assignable from int and bounded int “real” // numeric; assignable from all numeric types ]); src https://docs.google.com/document/d/ 1BDQIzPBtscxJFFlDUEPIo8ivKHgXT8_X6hz5quq7jK0/edit