Selection#

These expressions represent if and case expressions.

../../../_images/selection.svg

Conditional expression#

class ansys.scadeone.core.swan.IfteExpr(cond_expr: Expression, then_expr: Expression, else_expr: Expression)#

Bases: Expression

Conditional if/then/else expression: if expr then expr else expr.

get_full_path() str#

Full path of Swan construct.

static set_owner(owner: Self, children: Self | Iterable[Self])#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem]]

Items to set owner.

property cond_expr: Expression#

Condition expression.

property else_expr: Expression#

Else 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: Model#

Return model containing the Swan item.

property module: ModuleBase#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface

property owner: Self#

Owner of current Swan construct.

property then_expr: Expression#

Then expression.

Case expression#

class ansys.scadeone.core.swan.CaseExpr(expr: Expression, branches: List[CaseBranch])#

Bases: Expression

Case expression: case expr of {{ | pattern : expr }}+ ).

get_full_path() str#

Full path of Swan construct.

static set_owner(owner: Self, children: Self | Iterable[Self])#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem]]

Items to set owner.

property branches: List[CaseBranch]#

Case branches.

property expr: Expression#

Case 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: Model#

Return model containing the Swan item.

property module: ModuleBase#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface

property owner: Self#

Owner of current Swan construct.

class ansys.scadeone.core.swan.CaseBranch(pattern: Pattern, expr: Expression)#

Bases: SwanItem

Case branch expression: pattern : expr.

See ansys.scadeone.swan.expressions.CaseExpr.

get_full_path() str#

Full path of Swan construct.

static set_owner(owner: Self, children: Self | Iterable[Self])#

Helper to set owner as the owner of each item in the Iterable items.

Parameters:
ownerSwanItem

Owner of the items.

childrenUnion[SwanItem, Iterable[SwanItem]]

Items to set owner.

property expr: Expression#

Case branch 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: Model#

Return model containing the Swan item.

property module: ModuleBase#

Module containing the item.

Returns:

ModuleBase: module container, see ModuleBody and ModuleInterface

property owner: Self#

Owner of current Swan construct.

property pattern: Pattern#

Case branch pattern.