瀏覽代碼

Updated AToMPM conformance algorithm test example

Yentl Van Tendeloo 7 年之前
父節點
當前提交
f2be24ac46
共有 2 個文件被更改,包括 14 次插入6 次删除
  1. 13 5
      models/Conformance/AToMPM.alc
  2. 1 1
      wrappers/modelverse_SCCD.py

+ 13 - 5
models/Conformance/AToMPM.alc

@@ -23,10 +23,18 @@ Boolean function main(model : Element):
 
 	Element instances
 	String instance
-	instances = allInstances(model, "type_mapping/Instance")
-	while (set_len(instances) > 0):
-		instance = set_pop(instances)
-		dict_add(type_mapping, "model/" + string_replace(instance, "type_mapping/instance_", ""), "metamodel/" + string_replace(set_pop(allAssociationDestinations(model, instance, "type_mapping/TypeLink")), "type_mapping/type_", ""))
+	type_mapping = model["model"][set_pop(allInstances(model, "type_mapping/Root"))]
+
+	Element new_type_mapping
+	Element keys
+	String key
+	new_type_mapping = dict_create()
+	keys = dict_keys(type_mapping)
+	while (set_len(keys) > 0):
+		key = set_pop(keys)
+		dict_add(new_type_mapping, "model/" + key, "metamodel/" + cast_string(type_mapping[key]))
+
+	type_mapping = new_type_mapping
 	
 	// Check if each attribute is there, and satisfies the constraints
 	instances = dict_keys(type_mapping)
@@ -36,7 +44,7 @@ Boolean function main(model : Element):
 			// Got an instance of a Class
 			String type
 			Element inherits_from
-			type = type_mapping[instance]
+			type = cast_string(type_mapping[instance])
 
 			Element outgoing_links
 			String outgoing_link

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Wed May 30 15:01:47 2018
+Date:   Thu May 31 08:03:22 2018
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server