123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406 |
- include "primitives.alh"
- Diagram SCCD_my_PM {
- name = "SCCD example "
- {diagram_classes} Class A {
- name = "A"
- constructor_body = $
- Void function constructor(attributes : Element, parameters : Element):
- dict_add(attributes, "id", '')
- dict_add(attributes, "parent_id", '')
- return !
- $
- {behaviour} CompositeState root_a {
- name = "main"
- isInitial = True
- {composite_children} BasicState initial_a {
- name = "Init"
- isInitial = True
- }
- {composite_children} BasicState running_a {
- name = "Running"
- isInitial = False
- }
- {composite_children} BasicState done_a {
- name = "Done"
- isInitial = False
- }
- }
- }
- {diagram_classes} Class B {
- name = "B"
- constructor_body = $
- Void function constructor(attributes : Element, parameters : Element):
- dict_add(attributes, "id", '')
- dict_add(attributes, "parent_id", '')
- return !
- $
- {behaviour} CompositeState root_b {
- name = "main"
- isInitial = True
- {composite_children} BasicState initial_b {
- name = "Init"
- isInitial = True
- }
- {composite_children} BasicState running_b {
- name = "Running"
- isInitial = False
- }
- {composite_children} BasicState done_b {
- name = "Done"
- isInitial = False
- }
- }
- }
- {diagram_classes} Class C {
- name = "C"
- constructor_body = $
- Void function constructor(attributes : Element, parameters : Element):
- dict_add(attributes, "id", '')
- dict_add(attributes, "parent_id", '')
- return !
- $
- {behaviour} CompositeState root_c {
- name = "main"
- isInitial = True
- {composite_children} BasicState initial_c {
- name = "Init"
- isInitial = True
- }
- {composite_children} BasicState running_c {
- name = "Running"
- isInitial = False
- }
- {composite_children} BasicState done_c {
- name = "Done"
- isInitial = False
- }
- }
- }
- {diagram_classes} Class E {
- name = "E"
- constructor_body = $
- Void function constructor(attributes : Element, parameters : Element):
- dict_add(attributes, "id", '')
- dict_add(attributes, "parent_id", '')
- return !
- $
- {behaviour} CompositeState root_e {
- name = "main"
- isInitial = True
- {composite_children} BasicState initial_e {
- name = "Init"
- isInitial = True
- }
- {composite_children} BasicState running_e {
- name = "Running"
- isInitial = False
- {state_onentry_raises} Raise {
- event = "save"
- scope = "narrow"
- target = $
- Element function raise(attributes : Element):
- return attributes["parent_id"]!
- $
- parameters = $
- Element function raise(attributes : Element):
- Element result
- result = list_create()
- list_append(result, "bool")
- list_append(result, "E")
- return result!
- $
- }
- }
- {composite_children} BasicState done_e {
- name = "Done"
- isInitial = False
- }
- }
- }
- {diagram_classes} Class D {
- name = "D"
- constructor_body = $
- Void function constructor(attributes : Element, parameters : Element):
- dict_add(attributes, "id", '')
- dict_add(attributes, "parent_id", '')
- return !
- $
- {behaviour} CompositeState root_d {
- name = "main"
- isInitial = True
- {composite_children} BasicState initial_d {
- name = "Init"
- isInitial = True
- }
- {composite_children} BasicState running_d {
- name = "Running"
- isInitial = False
- }
- {composite_children} BasicState done_d {
- name = "Done"
- isInitial = False
- }
- }
- }
- {diagram_classes} Class F {
- name = "F"
- constructor_body = $
- Void function constructor(attributes : Element, parameters : Element):
- dict_add(attributes, "id", '')
- dict_add(attributes, "parent_id", '')
- return !
- $
- {behaviour} CompositeState root_f {
- name = "main"
- isInitial = True
- {composite_children} BasicState initial_f {
- name = "Init"
- isInitial = True
- }
- {composite_children} BasicState running_f {
- name = "Running"
- isInitial = False
- }
- {composite_children} BasicState done_f {
- name = "Done"
- isInitial = False
- }
- }
- }
- }
- transition (initial_a, running_a){
- event = "set_id"
- script = $
- Void function script(attributes : Element, parameters : Element):
- dict_overwrite(attributes, "id", parameters[0])
- dict_overwrite(attributes, "parent_id", parameters[1])
- log("CREATED ---- A")
- return!
- $
- }
- transition (running_a, done_a){
- after = $
- Float function after(attributes : Element):
- return 0.5!
- $
- script = $
- Void function script(attributes : Element, parameters : Element):
- log("FINISHED ---- A")
- return!
- $
- {transition_raises} Raise {
- scope = "narrow"
- event = "terminated"
- target = $
- String function raise(attributes : Element):
- return attributes["parent_id"]!
- $
- parameters = $
- Element function raise(attributes : Element, parameters : Element):
- Element result
- result = list_create()
- list_append(result, 'A')
- return result!
- $
- }
- {transition_raises} Raise {
- scope = "cd"
- event = "delete_instance"
- parameters = $
- Element function raise(attributes : Element, parameters : Element):
- Element result
- result = list_create()
- list_append(result, attributes["id"])
- return result!
- $
- }
- }
- transition (initial_b, running_b){
- event = "set_id"
- script = $
- Void function script(attributes : Element, parameters : Element):
- dict_overwrite(attributes, "id", parameters[0])
- dict_overwrite(attributes, "parent_id", parameters[1])
- log("CREATED ---- B")
- return!
- $
- }
- transition (running_b, done_b){
- after = $
- Float function after(attributes : Element):
- return 0.9!
- $
- script = $
- Void function script(attributes : Element, parameters : Element):
- log("FINISHED ---- B")
- return!
- $
- {transition_raises} Raise {
- scope = "narrow"
- event = "terminated"
- target = $
- Element function raise(attributes : Element):
- return attributes["parent_id"]!
- $
- parameters = $
- Element function raise(attributes : Element, parameters : Element):
- Element result
- result = list_create()
- list_append(result, 'B')
- return result!
- $
- }
- {transition_raises} Raise {
- scope = "cd"
- event = "delete_instance"
- parameters = $
- Element function raise(attributes : Element, parameters : Element):
- Element result
- result = list_create()
- list_append(result, attributes["id"])
- return result!
- $
- }
- }
- transition (initial_c, running_c){
- event = "set_id"
- script = $
- Void function script(attributes : Element, parameters : Element):
- dict_overwrite(attributes, "id", parameters[0])
- dict_overwrite(attributes, "parent_id", parameters[1])
- log("CREATED ---- C")
- return!
- $
- }
- transition (running_c, done_c){
- after = $
- Float function after(attributes : Element):
- return 0.5!
- $
- script = $
- Void function script(attributes : Element, parameters : Element):
- log("FINISHED ---- C")
- return!
- $
- {transition_raises} Raise {
- scope = "narrow"
- event = "terminated"
- target = $
- Element function raise(attributes : Element):
- return attributes["parent_id"]!
- $
- parameters = $
- Element function raise(attributes : Element, parameters : Element):
- Element result
- result = list_create()
- list_append(result, "C")
- return result!
- $
- }
- {transition_raises} Raise {
- scope = "cd"
- event = "delete_instance"
- parameters = $
- Element function raise(attributes : Element, parameters : Element):
- Element result
- result = list_create()
- list_append(result, attributes["id"])
- return result!
- $
- }
- }
- transition (initial_e, running_e){
- event = "set_id"
- script = $
- Void function script(attributes : Element, parameters : Element):
- dict_overwrite(attributes, "id", parameters[0])
- dict_overwrite(attributes, "parent_id", parameters[1])
- log("CREATED ---- E")
- return!
- $
- }
- transition (running_e, done_e){
- after = $
- Float function after(attributes : Element):
- return 0.5!
- $
- script = $
- Void function script(attributes : Element, parameters : Element):
- log("FINISHED ---- E")
- return!
- $
- {transition_raises} Raise {
- scope = "narrow"
- event = "terminated"
- target = $
- Element function raise(attributes : Element):
- return attributes["parent_id"]!
- $
- parameters = $
- Element function raise(attributes : Element, parameters : Element):
- Element result
- result = list_create()
- list_append(result, "E")
- return result!
- $
- }
- {transition_raises} Raise {
- scope = "cd"
- event = "delete_instance"
- parameters = $
- Element function raise(attributes : Element, parameters : Element):
- Element result
- result = list_create()
- list_append(result, attributes["id"])
- return result!
- $
- }
- }
- transition (initial_f, running_f){
- event = "set_id"
- script = $
- Void function script(attributes : Element, parameters : Element):
- dict_overwrite(attributes, "id", parameters[0])
- dict_overwrite(attributes, "parent_id", parameters[1])
- log("CREATED ---- F")
- return!
- $
- }
- transition (running_f, done_f){
- after = $
- Float function after(attributes : Element):
- return 0.5!
- $
- script = $
- Void function script(attributes : Element, parameters : Element):
- log("FINISHED ---- F")
- return!
- $
- {transition_raises} Raise {
- scope = "narrow"
- event = "terminated"
- target = $
- Element function raise(attributes : Element):
- return attributes["parent_id"]!
- $
- parameters = $
- Element function raise(attributes : Element, parameters : Element):
- Element result
- result = list_create()
- list_append(result, attributes['id'])
- return result!
- $
- }
- {transition_raises} Raise {
- scope = "cd"
- event = "delete_instance"
- parameters = $
- Element function raise(attributes : Element, parameters : Element):
- Element result
- result = list_create()
- list_append(result, attributes["id"])
- return result!
- $
- }
- }
|