Input parameters

The .in prefix designates a parameter passed into an activity.

next destination = in.floor

If the above example is in a state activity, the value of the floor parameter packaged with the event that triggered the incoming transition is assigned to the scalar variable on the LHS.

Variable types that can be passed as input parameters depend on the type of activity as follows:

State activities: Scalar and table variables only

Class methods: All variable types

Domain operations: All variable types

Instance references are valid only within an activity so they can’t be passed across states. Since a domain operation or class method is invoked between states, they can assume that instance references are valid.

Signatures

In all activity types, parameter names are specified using formal : actual pairing. So order within a signature is not significant. Consider an event specification defined as follows:

Set new dest( Destination : Name, Direction : Vdir )

Two parameters, Destination and Direction, with data types Name and Vdir are required in the Set new dest event specification. To generate a corresponding event, supply values of the appropriate types paired up with the parameter names in any order.

Set new dest( Direction : in.Dir, Destination : in.Dest floor ) -> me

No need for name doubling

Note how the parameter names and supplied variable names closely match? As a convenience, and to avoid name doubling clutter, you can drop the formal parameter if the name of the actual parameter matches the formal parameter name. Let’s rewrite the event specification as follows:

Set new dest( Dest floor : Name, Dir : Vdir )

Now the formal parameter names match the actual parameter names so you can do this shorthand instead:

Set new dest( in.Dir, in.Dest floor ) -> me  // less clutter

With the in. prefix stripped off, the names match and there is no confusion. Even if the order is switched, lack of a formal parameter implies that the name matches. If not, there will be an error. The action language is now easier to read and less trouble to write.