Przeglądaj źródła

Simplified the matches operation

Yentl Van Tendeloo 8 lat temu
rodzic
commit
2d5cad00f3
3 zmienionych plików z 8 dodań i 17 usunięć
  1. 2 2
      bootstrap/transform.alc
  2. 4 15
      models/matches.mvc
  3. 2 0
      models/query.mvc

+ 2 - 2
bootstrap/transform.alc

@@ -248,8 +248,8 @@ Element function full_match(host_model : Element, schedule_model : Element, curr
 		if (allowed):
 			set_add(final_mappings, mapping)
 
-		if (single_ok):
-			break!
+			if (single_ok):
+				break!
 
 	return final_mappings!
 

+ 4 - 15
models/matches.mvc

@@ -8,31 +8,20 @@ A B {
         {Contains} Success success {}
         {Contains} Query match {
             LHS {
-                Pre_ReachabilityGraph/State {
-                    label = "1"
-                }
-            }
-            NAC {
-                Pre_ReachabilityGraph/State pre_1 {
-                    label = "1"
-                }
-                Pre_Query/Place pre_2 {
+                Pre_Query/Place {
                     label = "2"
                 }
                 Pre_ReachabilityGraph/Place pre_3 {
                     label = "3"
                 }
-                Pre_ReachabilityGraph/Contains (pre_1, pre_3) {
-                    label = "5"
-                }
 
                 constraint = $
                     Boolean function constraint(host_model : Element, mapping : Element):
                         Boolean names_match
-                        Boolean tokens_mismatch
+                        Boolean tokens_match
                         names_match = value_eq(read_attribute(host_model, mapping["2"], "name"), read_attribute(host_model, mapping["3"], "name"))
-                        tokens_mismatch = value_neq(read_attribute(host_model, mapping["2"], "tokens"), read_attribute(host_model, mapping["3"], "tokens"))
-                        return bool_and(names_match, tokens_mismatch)!
+                        tokens_match = value_eq(read_attribute(host_model, mapping["2"], "tokens"), read_attribute(host_model, mapping["3"], "tokens"))
+                        return bool_and(names_match, tokens_match)!
                     $
             }
         }

+ 2 - 0
models/query.mvc

@@ -9,5 +9,7 @@ SimpleClassDiagrams Query {
     Class Place {
         name : String
         tokens : Natural
+        lower_cardinality = 1
+        upper_cardinality = 1
     }
 }