|
@@ -1,16 +1,406 @@
|
|
|
-
|
|
|
-Diagram SCCD_Example {
|
|
|
+include "primitives.alh"
|
|
|
+Diagram SCCD_my_PM {
|
|
|
name = "SCCD example "
|
|
|
{diagram_classes} Class A {
|
|
|
name = "A"
|
|
|
-
|
|
|
- {behaviour} CompositeState manager_main {
|
|
|
+ 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 manager_main_start {
|
|
|
- name = "start"
|
|
|
+ {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!
|
|
|
+ $
|
|
|
+ }
|
|
|
}
|