If you find all that magic detection of variables in Magic Model Analyst® (Cameo Simulation Toolkit®) from "names" within guards on ControlFlow edges outgoing from a DecisionNode a bit mysterious and want to use some basic Boolean logic this might be for you.
A convenient way to explore this in Magic Model Analyst® (Cameo Simulation Toolkit®) is to use the ReadLine
Activity from the fUML_Library.mdzip, which you can load via Use Project > Use Local Project then select under <install.root>/modelLibraries
. You can then input 'test' values via a CLI in the simulation console.
Rather than using Cameo's "magical" implied variable detection based on a "freestyle" guard, an OpaqueBehavior with this Groovy script is used here to convert from some candidate inputs to a hard Boolean true
or false
:
List match = ["True", "true", "Yes", "yes", "y", "Y"];
o = (i != null && i != "" && match.any { it.contains(i) })
IMPORTANT: the guard [true]
uses a LiteralBoolean true
.
For a mini video of it simulated visit:
Compare with using a "magical" implied variable [name]
in the guard as shown here:
Related:
Visit also the many Mini SysML/UML simulations videos.