The Alf editor may be used to create an Alf body for a new Opaque Behavior or to edit the existing Alf body of an Opaque Behavior. The Alf code for an Opaque Behavior is stored as the body of the Opaque Behavior with the language Alf. Compiling this Alf code results in the creation of an executable Activity reflecting the behavior defined by the Alf code. This Activity is attached to the Opaque Behavior as a tagged value of the special CompiledRepresentation stereotype. (See also the discussion on the Alf compiler.)
To create an Opaque Behavior with an Alf body
- Create an Opaque Behavior in the Model Browser.
Add Parameters to the Opaque Behavior as desired.
Select the Opaque Behavior in the Model Browser and open the Alf editor window (select Windows > Alf), if it isn't already open.
Enter the Alf code for the Opaque Behavior and press Save to compile and save the code.
To edit an existing Alf body for an Opaque Behavior
- Select the Opaque Behavior in the Model Browser and open the Alf editor window (select Windows > Alf), if it isn't already open. The existing Alf code will be displayed in the window.

The Alf code for an Opaque Behavior can also be entered or edited directly in the Body and Language property in the Specification window for the Opaque Behavior. If you open the Edit Body and Language window, then the Alf code may be edited 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 text is saved, and, if it has no errors, compiled. If you press Cancel, the Alf text is not saved.

Editing Alf in an Opaque Behavior body