We released YAKINDU Statechart Tools Standard and Professional Edition version 3.1.0 today! Apart from several bug fixes we added the following main features:
An generator model may assign values to properties and later use these properties in expressions. The following sample generator model uses the var keyword to declare the properties projectName, version, isBeta, and generateTimerServce with their respective types and default values.
GeneratorModel for yakindu::java { //Variables can be overridden from command line interface: var projectName : string = "light_switch_series" var version : string = "1.0" var isBeta : boolean = true var generateTimerServce : boolean = true statechart myStateAutomaton { feature Outlet { targetProject = projectName targetFolder = "src-gen/" + version + (isBeta ? "beta" : "") libraryTargetFolder = "src" } feature GeneralFeatures { TimerService = generateTimerServce } } }
The model then uses these values in feature clauses by referring to the properties: The values assigned to properties are default values only and can be overridden from the headless code generator like this:
scc -m myGenmodel.sct -v version=2.0;isBeta=false
The name/value pairs specified by the -v option would override the corresponding default values of the properties in the generator model.This is a very flexible way to tailor the code generator within a headless build.
Read more about this feature in our user guide.
Now you can can use named parameters when calling an operation. Consider the following operation declaration:
operation myOperation(xValue : int, yValue : int) : void
This can be called with name parameters like this:
myOperation(xValue = 27, yValue = 42)
Named parameters make their order irrelevant. The following call is semantically equivalent to the one above:
myOperation(yValue = 42, xValue = 27)
While an operation call with named parameters is longer than the equivalent call with positional parameters, named parameters are a great means for self-documenting code (especially if the parameter names are more telling than in the example above).
The Outlet feature now has an option to skip the generation of library files. This is useful to prevent the generation of a new library file when an existing one should be used:
skipLibraryFiles (Boolean, optional): If you wish to exclude the static files from the code generation, i.e. those that are put into the libraryTargetFolder, you can set this value to true. If the value is false or not specified at all, the files are generated as usual. Currently supported for the Java, C and C++ generators.
feature Outlet { targetProject = projectName targetFolder = "src-gen/" libraryTargetFolder = "src" skipLibraryFiles = headless ? true : false }