Documentation Language: Swift

Structure

ATLIterateExpression

Represents an ATL iterate expression with complex syntax.

struct ATLIterateExpression

Overview

The iterate expression supports the OCL-style iterate syntax:

collection->iterate(param; accumulator : Type = defaultValue | body_expression)

Example Usage

let iterateExpr = ATLIterateExpression(
    source: ATLVariableExpression(name: "numbers"),
    parameter: "n",
    accumulator: "sum",
    accumulatorType: "Integer",
    defaultValue: ATLLiteralExpression(value: 0),
    body: ATLBinaryExpression(
        left: ATLVariableExpression(name: "sum"),
        operator: .add,
        right: ATLVariableExpression(name: "n")
    )
)

Topics

Operators

Initializers

Instance Properties

V
accumulator

The accumulator variable name.

V
accumulatorType

The accumulator type (optional).

V
body

The body expression that computes the new accumulator value.

V
defaultValue

The default value for the accumulator.

V
parameter

The iteration parameter name.

V
source

The source collection expression.

Instance Methods

F
evaluate(in:)

Evaluates the iterate expression in the given execution context.

Default Implementations

Relationships

Conforms To