浏览代码

Update PM metamodel

Yentl Van Tendeloo 8 年之前
父节点
当前提交
e273c5b27e
共有 3 个文件被更改,包括 17 次插入200 次删除
  1. 5 5
      core/core_algorithm.alc
  2. 12 3
      core/pm.mvc
  3. 0 192
      integration/test_mvc.py

+ 5 - 5
core/core_algorithm.alc

@@ -712,11 +712,7 @@ Void function enact_PM(pm : Element, prefix : String, user_id : String):
 		elif (type == "Finish"):
 			// Should be impossible, as we would have ended...
 			result = result
-		elif (type == "Fork"):
-			// Just fork, so we have multiple outgoing
-			// Not a problem, as we already can do this with the usual code
-			result = result
-		elif (type == "Join"):
+		elif (type == "JoinFork"):
 			// Only do this if all dependencies are fullfilled
 			// So add to the counter of this Join
 			dict_overwrite(counters, element, integer_addition(counters[element], 1))
@@ -748,6 +744,10 @@ Void function enact_PM(pm : Element, prefix : String, user_id : String):
 				// Apparently it is False, so map this to the "Else" branch
 				set_add(worklist, create_tuple(set_pop(allAssociationDestinations(pm, element, "Else")), True))
 				continue!
+			else:
+				// Apparently it is True, so map this to the "Then" branch
+				set_add(worklist, create_tuple(set_pop(allAssociationDestinations(pm, element, "Then")), True))
+				continue!
 
 		// We have finished the execution, so add all outgoing edges to the worklist
 		Element all_next

+ 12 - 3
core/pm.mvc

@@ -1,5 +1,6 @@
 import models/SimpleClassDiagrams as SimpleClassDiagrams
 include "primitives.alh"
+include "object_operations.alh"
 
 SimpleClassDiagrams ProcessModel {
     SimpleAttribute MvCName {
@@ -20,9 +21,16 @@ SimpleClassDiagrams ProcessModel {
     Class Finish : Activity {
         lower_cardinality = 1
     }
-    Class Fork : Activity {}
-    Class Join : Activity {}
-    Class Decision : Activity {}
+    Class JoinFork : Activity {}
+    Class Decision : Activity {
+        constraint = $
+            String function constraint(model : Element, name : String):
+                if (read_nr_out(allOutgoingAssociationInstances(model, name, "Next")) == 0):
+                    return "OK"!
+                else:
+                    return "Decision node cannot have a normal 'Next' link"!
+            $
+    }
 
     Class Exec : Activity {
         name : MvCName
@@ -35,6 +43,7 @@ SimpleClassDiagrams ProcessModel {
 
     Association Produces (Exec, Data) {}
     Association Consumes (Data, Exec) {}
+    Association Then (Decision, Activity) {}
     Association Else (Decision, Activity) {}
     Association Next (Activity, Activity) {}
 }

+ 0 - 192
integration/test_mvc.py

@@ -2131,195 +2131,3 @@ class TestModelverseCore(unittest.TestCase):
                      ]),
                 "Ready for command...",
             ]))
-
-    def test_process_model_simple_pn(self):
-        self.assertTrue(run_file(all_files,
-            [ "root", "root", "root", 
-                "model_add",
-                    "SimpleClassDiagrams",
-                    "PetriNet",
-                    ] + get_model_constructor(open("integration/code/pn_design.mvc", "r").read()) + [
-                "model_add",
-                    "SimpleClassDiagrams",
-                    "ReachabilityGraph",
-                    ] + get_model_constructor(open("integration/code/reachability_graph.mvc", "r").read()) + [
-                "model_list",
-                "transformation_add_MT_language",
-                "PetriNet",
-                "",
-                "PetriNet_RAM",
-                "transformation_add_MT_language",
-                "ReachabilityGraph",
-                "",
-                "ReachabilityGraph_RAM",
-                "transformation_add_MT",
-                    "PetriNet_RAM",
-                    "",
-                    "PetriNet",
-                    "",
-                    "initialize_PN",
-                    ] + get_model_constructor(open("integration/code/initialize_PN.mvc", "r").read()) + [
-                "transformation_add_MANUAL",
-                    "PetriNet",
-                    "",
-                    "PetriNet",
-                    "",
-                    "refine_PN",
-                "transformation_add_AL",
-                    "PetriNet",
-                    "",
-                    "ReachabilityGraph",
-                    "",
-                    "reachability",
-                    ] + get_constructor(open("integration/code/reachability.alc", "r").read()) + [
-                "transformation_add_MT",
-                    "ReachabilityGraph_RAM",
-                    "ReachabilityGraph",
-                    "",
-                    "",
-                    "reachability_print",
-                    ] + get_model_constructor(open("integration/code/reachabilitygraph_print.mvc", "r").read()) + [
-                "model_add",
-                    "ProcessModel",
-                    "pn_reachability",
-                    ] + get_model_constructor(open("integration/code/pm_pn_reachability.mvc", "r").read()) + [
-                "model_list",
-                "process_execute",
-                "pn_reachability",
-                "my_",
-                    "instantiate",
-                        "PetriNet/Place",
-                        "crit_1",
-                        "attr_add",
-                            "crit_1",
-                            "name",
-                            "crit_1",
-                        "attr_add",
-                            "crit_1",
-                            "tokens",
-                            0,
-                    "instantiate",
-                        "PetriNet/Place",
-                        "crit_2",
-                        "attr_add",
-                            "crit_2",
-                            "name",
-                            "crit_2",
-                        "attr_add",
-                            "crit_2",
-                            "tokens",
-                            0,
-                    "instantiate",
-                        "PetriNet/Place",
-                        "free",
-                        "attr_add",
-                            "free",
-                            "name",
-                            "free",
-                        "attr_add",
-                            "free",
-                            "tokens",
-                            1,
-                    "instantiate",
-                        "PetriNet/Transition",
-                        "acq_1",
-                        "attr_add",
-                            "acq_1",
-                            "name",
-                            "acq_1",
-                    "instantiate",
-                        "PetriNet/Transition",
-                        "acq_2",
-                        "attr_add",
-                            "acq_2",
-                            "name",
-                            "acq_2",
-                    "instantiate",
-                        "PetriNet/Transition",
-                        "rel_1",
-                        "attr_add",
-                            "rel_1",
-                            "name",
-                            "rel_1",
-                    "instantiate",
-                        "PetriNet/Transition",
-                        "rel_2",
-                        "attr_add",
-                            "rel_2",
-                            "name",
-                            "rel_2",
-                    "instantiate",
-                        "PetriNet/P2T",
-                        "a1i",
-                        "free",
-                        "acq_1",
-                        "attr_add",
-                            "a1i",
-                            "weight",
-                            1,
-                    "instantiate",
-                        "PetriNet/T2P",
-                        "a1o",
-                        "acq_1",
-                        "crit_1",
-                        "attr_add",
-                            "a1o",
-                            "weight",
-                            1,
-                    "instantiate",
-                        "PetriNet/P2T",
-                        "a2i",
-                        "free",
-                        "acq_2",
-                        "attr_add",
-                            "a2i",
-                            "weight",
-                            1,
-                    "instantiate",
-                        "PetriNet/T2P",
-                        "a2o",
-                        "acq_2",
-                        "crit_2",
-                        "attr_add",
-                            "a2o",
-                            "weight",
-                            1,
-                    "instantiate",
-                        "PetriNet/P2T",
-                        "r1i",
-                        "crit_1",
-                        "rel_1",
-                        "attr_add",
-                            "r1i",
-                            "weight",
-                            1,
-                    "instantiate",
-                        "PetriNet/T2P",
-                        "r1o",
-                        "rel_1",
-                        "free",
-                        "attr_add",
-                            "r1o",
-                            "weight",
-                            1,
-                    "instantiate",
-                        "PetriNet/P2T",
-                        "r2i",
-                        "crit_2",
-                        "rel_2",
-                        "attr_add",
-                            "r2i",
-                            "weight",
-                            1,
-                    "instantiate",
-                        "PetriNet/T2P",
-                        "r2o",
-                        "rel_2",
-                        "free",
-                        "attr_add",
-                            "r2o",
-                            "weight",
-                            1,
-                    "exit",
-                "model_list",
-            ], None))