You can use an Alf expression the guard for an Activity Edge (Object Flow or Control Flow) in an Activity. However, in this case, it is generally easier to create the Expression directly into the Specification window for the Activity Edge, and then subsequently edit it using the Alf editor.
To create an Alf guard Expression
Click on the Guard property and then click on the button at the left of the field.
In the Edit Guard window, select Alf for Language (you may need to scroll up in the menu) and enter the Alf code for the expression into the Body field.
Note that the text entered must be for an expression, not a statement. Therefore, it must not have a semicolon at the end. The expression can access attribute values of the context Classifier of the Activity containing its Activity Edge (using Alf this expressions) or the decision input value for the Decision Node (see Accessing data in Activity Edge guards). |
To make Alf the default language for Opaque Expressions
|
To edit an Alf guard Expression using the Alf editor
You also can edit the Alf code in theĀ Edit Guard window just as in the Alf editor window. However, instead of Save and Revert buttons, this window has OK and Cancel buttons, either of which will close it. If you press OK, then the Alf text is saved, and, if it has no errors, compiled. If you pressĀ Cancel, the Alf text is not saved.
To edit an Alf guard Expression in the Edit Guard window
Edit the Alf expression as above.