StateMachine diagram for comparing action language access to an operation for a guard

Gallery
Tutorial
The StateMachine simply enables us to navigate to states representing each of the candidate scripting languages, with an attempt at leveraging the operation isTrue() via the corresponding scripting language. You can then return to the Init state using the Retry signal.
Click on the image to view it full size

First we'll look at what fails. As far as I can tell, there is no way to "directly" access the operation isTrue() defined on the context class using any of these scripting languages: "English" (vendor-specific built-in), BeanShell, JavaScript, JavaScript Rhino, Groovy. (There are some other candidates, I did not try them all.) This is indicated by a custom diagnostic stereotype «!ERROR».

The Action Language for Foundational UML (Alf) - which requires an additional commercial plugin - makes it easy! Just access the operation on the guard as:

[this.isTrue()]

The access via Action Language Helper (ALH) is not as elegant, but it works:

[ALH.callOperation($context$,"isTrue")]

That is relatively indirect compared with the Alf form. Note that I could not just use ALH.callOperation("isTrue"), I needed to go via the explicit pre-defined variable $context$ object (which you can also access using ALH.getContext()). You can also use self, which is equivalent to $context$:

[ALH.callOperation(self,"isTrue")]
— END OF TRAIL —

You may wish to visit one of these tutorials next:

Visit more Systems Modeling Language v1 (SysML®) tutorial trails here.
Visit also these screencast tutorial videos

Please email or phone Webel IT Australia on +61 405 029 008 to arrange On-Site, Off-Site, or Live Online remote web training seminars and workshops.
Up next
Notes
Snippets (quotes/extracts)
Visit also
Visit also (backlinks)
Related slides (includes other tutorials)
Related slides (backlinks, includes other tutorials)
External links