@xlia< system , 1.0 >: | |
system<and> mySystem { | |
@machine: | |
statemachine Cook { | |
@property: | |
type Ingredients enum {TOMATOES, WHEAT, RICE, BASILISK, MOZZARELLA, MUSHROOMS} | |
type Recipe struct { | |
var string name; | |
var set<Ingredients> ingredients; | |
} | |
public var Recipe invented_recipe; | |
public port output invention(Recipe); | |
@region: | |
state<initial> source {transition startup --> inventing_pizza;} | |
state inventing_pizza { | |
transition invention1 --> finished { | |
// here is the syntax to initialize the value of a structured type variable | |
// we simply list (between brackets and separated by commas) | |
// the initial values of each element of the structure | |
invented_recipe = {"Pizza", {TOMATOES, WHEAT, MOZZARELLA, BASILISK}}; | |
// here is an example of modification of a structured type value | |
invented_recipe.name += " Margherita"; | |
output invention(invented_recipe); | |
} | |
} | |
state<terminal> finished; | |
} | |
@com: | |
connect<env>{ | |
output Cook->invention; | |
} | |
} | |