Functional update#
Functional update is the modification of an array or a structure with the creation of a new value.
Operation |
Kind |
|---|---|
_ with [_] |
Array update, |
_ with .l |
Structure update, |
See also LabelOrIndex.
- class ansys.scadeone.core.swan.FunctionalUpdate(expr: Expression, is_starred: bool, modifiers: List[Modifier])#
Bases:
ExpressionCopy with modification:
copy: ( expr with modifier {{ ; modifier }} [[ ; ]] ).
replacing functional update ( expr with * modifier {{ ; modifier }} [[ ; ]] ).
- get_full_path() str#
Full path of the Swan construct.
This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.
- Returns:
strPath within the owner and name of the Swan construct.
- Raises:
ScadeOneExceptionIf the method is not implemented for the current SwanItem type.
- static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#
Helper to set owner as the owner of each item in the Iterable items.
- property at: Identifier | None#
Memory constrained location.
- property expr: Expression#
Expression.
- property is_protected: bool#
Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).
- property model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- class ansys.scadeone.core.swan.Modifier(modifier: List[LabelOrIndex] | str, expr: Expression)#
Bases:
SwanItemModifier expression: {{ label_or_index }}+ = expr.
Label of index can be syntactically incorrect. In which case, _modifier_ is a string, and is_protected property is True.
See
FunctionalUpdate.- get_full_path() str#
Full path of the Swan construct.
This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.
- Returns:
strPath within the owner and name of the Swan construct.
- Raises:
ScadeOneExceptionIf the method is not implemented for the current SwanItem type.
- static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#
Helper to set owner as the owner of each item in the Iterable items.
- property expr: Expression#
Modifier expression.
- property model: IModel#
Return model containing the Swan item.
- property modifier: List[LabelOrIndex] | str#
Modifier as label or index.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.