Array#
The following table lists all array operations. Operations are indicated with respect to the syntax given in the Scade One documentation.
Operation |
Class |
|---|---|
^ (Repetition) |
|
@ (Concatenation) |
See Binary expressions and N-ary expressions |
[_] (Array constructor) |
|
.[i] (Projection) |
|
.[_] default _ (Projection with default) |
|
flatten |
|
reverse |
|
_[i..j] (Slice) |
|
transpose |
|
_ with[_] (Functional update) |
|
pack |
Array operations#
- class ansys.scadeone.core.swan.ArrayRepetition(expr: Expression, size: Expression)#
Bases:
ExpressionArray expression: expr ^ expr.
- static set_owner(owner: SwanItem | IProject | None, children: SwanItem | Iterable[SwanItem]) None#
Helper to set owner as the owner of each item in the Iterable items.
- 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 module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- property size: Expression#
Array size.
- class ansys.scadeone.core.swan.ArrayConstructor(group: Group)#
Bases:
ExpressionArray construction expression: [ group ].
- static set_owner(owner: SwanItem | IProject | None, children: SwanItem | Iterable[SwanItem]) None#
Helper to set owner as the owner of each item in the Iterable items.
- 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 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.ArrayProjection(expr: Expression, index: Expression)#
Bases:
ExpressionStatic projection: expr [index], where index is a static expression.
- static set_owner(owner: SwanItem | IProject | None, children: SwanItem | Iterable[SwanItem]) None#
Helper to set owner as the owner of each item in the Iterable items.
- property expr: Expression#
Expression.
- property index: Expression#
Index 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 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.Slice(expr: Expression, start: Expression, end: Expression)#
Bases:
ExpressionSlice expression: expr [ expr .. expr].
- static set_owner(owner: SwanItem | IProject | None, children: SwanItem | Iterable[SwanItem]) None#
Helper to set owner as the owner of each item in the Iterable items.
- property end: Expression#
End of slice expression.
- 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 module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- property start: Expression#
Start of slice expression.
- class ansys.scadeone.core.swan.ProjectionWithDefault(expr: Expression, indices: List[LabelOrIndex], default: Expression)#
Bases:
ExpressionDynamic projection: (expr . {{ label_or_index }}+ default expr).
- static set_owner(owner: SwanItem | IProject | None, children: SwanItem | Iterable[SwanItem]) None#
Helper to set owner as the owner of each item in the Iterable items.
- property default: Expression#
Default value.
- property expr: Expression#
Expression.
- property indices: List[LabelOrIndex]#
List of indices.
- 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 module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
Other array operations#
Arrays support the flatten, reverse, pack, and transpose operations.
Operations are implemented by the PrefixPrimitive with
an enumeration to select the proper operation.
transpose is associated with the Transpose
(derives from PrefixPrimitive) to handle the
operation parameters.
- class ansys.scadeone.core.swan.PrefixPrimitive(kind: PrefixPrimitiveKind, sizes: List[Expression])#
Bases:
OperatorBaseCall to primitive operator: operator ::= prefix_primitive [[sizes]] with prefix_primitive: flatten, pack, reverse, operators.
- static set_owner(owner: SwanItem | IProject | None, children: SwanItem | Iterable[SwanItem]) None#
Helper to set owner as the owner of each item in the Iterable items.
- 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 kind: PrefixPrimitiveKind#
Primitive kind.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- property sizes: List[Expression]#
Size parameters of call.
- class ansys.scadeone.core.swan.PrefixPrimitiveKind(value)#
Bases:
EnumPrefix primitive kind: reverse, transpose, pack, and flatten.
- Flatten = 1#
flatten array operation.
- Pack = 2#
pack array operation.
- Reverse = 3#
reverse array operation.
- Transpose = 4#
transpose array operation.
- class ansys.scadeone.core.swan.Transpose(params: List[str] | str, sizes: List[Expression])#
Bases:
PrefixPrimitiveTranspose operator.
Parameters are a list of integer, but could be a single string if the indices are syntactically incorrect.
- static set_owner(owner: SwanItem | IProject | None, children: SwanItem | Iterable[SwanItem]) None#
Helper to set owner as the owner of each item in the Iterable items.
- 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 kind: PrefixPrimitiveKind#
Primitive kind.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- property params: List[str] | str#
Transpose indices as list of str is transpose indices are valid, else the invalid string of indices.
- property sizes: List[Expression]#
Size parameters of call.