Skip to main content
Version: 7.0

MULTI operator

The MULTI operator creates an action that implements branching (polymorphic form).

Syntax

MULTI [exclusionType] action1, ..., actionN 

Description

The MULTI operator creates an action that executes one of the actions passed to it depending on whether the selection conditions are met. The selection condition for each action is that the call parameters match that action's signature; the action whose condition is met is executed.

Parameters

  • exclusionType

    Type of mutual exclusion. Determines whether several action-selection conditions can be met simultaneously for a certain set of parameters:

    • EXCLUSIVE - the action-selection conditions cannot be met simultaneously. Used by default.
    • OVERRIDE - several conditions can be met simultaneously; in this case the first action in the list whose condition is met is selected.
  • action1, ..., actionN

    A list of context dependent action operators which define the actions from which the selection is made.

Example

CLASS Shape;

CLASS Square : Shape;
CLASS Circle : Shape;

message (Square s) { MESSAGE 'Square'; }
message (Circle c) { MESSAGE 'Circle'; }

message (Shape s) = MULTI message[Square](s), message[Circle](s);