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:
Expression
Array expression: expr ^ expr.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
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#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- property size: Expression#
Array size.
- class ansys.scadeone.core.swan.ArrayConstructor(group: Group)#
Bases:
Expression
Array construction expression: [ group ].
- static set_owner(owner: Self, children: Self | Iterable[Self])#
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#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- class ansys.scadeone.core.swan.ArrayProjection(expr: Expression, index: Expression)#
Bases:
Expression
Static projection: expr [index], where index is a static expression.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
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#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- class ansys.scadeone.core.swan.Slice(expr: Expression, start: Expression, end: Expression)#
Bases:
Expression
Slice expression: expr [ expr .. expr].
- static set_owner(owner: Self, children: Self | Iterable[Self])#
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#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- property start: Expression#
Start of slice expression.
- class ansys.scadeone.core.swan.ProjectionWithDefault(expr: Expression, indices: List[LabelOrIndex], default: Expression)#
Bases:
Expression
Dynamic projection: (expr . {{ label_or_index }}+ default expr).
- static set_owner(owner: Self, children: Self | Iterable[Self])#
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#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
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:
OperatorBase
Call to primitive operator: operator ::= prefix_primitive [[sizes]] with prefix_primitive: flatten, pack, reverse, operators.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
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#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- property sizes: List[Expression]#
Size parameters of call.
- class ansys.scadeone.core.swan.PrefixPrimitiveKind(value)#
Bases:
Enum
Prefix 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[int] | str, sizes: List[Expression])#
Bases:
PrefixPrimitive
Transpose operator.
Parameters are a list of integer, but could be a single string if the indices are syntactically incorrect.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
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#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- property sizes: List[Expression]#
Size parameters of call.