The WhenValid Activity as effect Behavior

The "final" Transition out of the PartialDial State (the one that has the number validation guard) also has an effect Behavior indicated as /WhenValid, which is an Activity:
Click on the image to view it full size

We see it prints a message using an OpaqueAction, then it uses a ReadSelfAction to get at its context Dialer and a ReadStructuralFeatureAction to get at a reference to the "parent"controller:Controller, which is then used as the target for a SendSignalAction with a Connect signal.

Which brings us back to our top-level Controller Activity, which is waiting with an AcceptEventAction with a SignalEvent trigger for a Connect Signal as shown under:

OK, we've come full circle. We've seen how Activities as entry, exit Behaviors on States and as effect Behaviors on Transitions work to bring StateMachines to life, and on the way we've also learnt some of the basic principles of using Activities to invoke Operations, to send and receive Signals, and to coordinate behavior.

But before we finish, at the start I said for "elegance" I used the Action Language for Foundational UML (Alf) to access the validation operation on some guards (which requires the commercial Alf Plugin). Let's see how one might tackle that using the vendor-specific Action Language Helper (ALH) instead

Up next
Snippets (quotes/extracts)
Visit also
Visit also (backlinks)
Related slides (other tutorials)
Related slides (other tutorials, backlinks)