Browse Source

Fixed bug in model_fuse

Yentl Van Tendeloo 8 years ago
parent
commit
067b89c837
1 changed files with 10 additions and 2 deletions
  1. 10 2
      bootstrap/core_algorithm.alc

+ 10 - 2
bootstrap/core_algorithm.alc

@@ -1168,6 +1168,7 @@ String function transformation_add(user_id : String, source_models : Element, ta
 	String merged_formalism_id
 	String source_formalism_id
 	String tracability_link
+	Element fused
 	Element keys
 	String key
 	Element mm
@@ -1176,6 +1177,7 @@ String function transformation_add(user_id : String, source_models : Element, ta
 	target = dict_create()
 	all_formalisms = set_create()
 	formalism_map = set_create()
+	fused = set_create()
 
 	keys = dict_keys(source_models)
 	while (set_len(keys) > 0):
@@ -1190,7 +1192,10 @@ String function transformation_add(user_id : String, source_models : Element, ta
 					if (element_eq(mm, read_root())):
 						return "Transformation source type not in SimpleClassDiagrams hierarchy: " + key!
 
-					set_add_node(formalism_map, create_tuple(key, mm))
+					if (bool_not(set_in(fused, key))):
+						set_add_node(formalism_map, create_tuple(key, mm))
+						set_add(fused, key)
+
 					if (bool_not(set_in(all_formalisms, model_id))):
 						set_add(all_formalisms, model_id)
 				else:
@@ -1213,8 +1218,11 @@ String function transformation_add(user_id : String, source_models : Element, ta
 					if (element_eq(mm, read_root())):
 						return "Transformation target type not in SimpleClassDiagrams hierarchy: " + key!
 
-					if (bool_not(set_in(all_formalisms, model_id))):
+					if (bool_not(set_in(fused, key))):
 						set_add_node(formalism_map, create_tuple(key, mm))
+						set_add(fused, key)
+
+					if (bool_not(set_in(all_formalisms, model_id))):
 						set_add(all_formalisms, model_id)
 				else:
 					return "Name already selected for target: " + key!