浏览代码

Fix (?) for traceability models

Yentl Van Tendeloo 7 年之前
父节点
当前提交
72921eb218
共有 2 个文件被更改,包括 12 次插入21 次删除
  1. 9 19
      bootstrap/model_management.alc
  2. 3 2
      bootstrap/tracability.mvc

+ 9 - 19
bootstrap/model_management.alc

@@ -253,27 +253,17 @@ Element function model_split(merged_model : Element, models : Element, tracabili
 				src = reverse[cast_id2s(read_edge_src(elem))]
 				dst = reverse[cast_id2s(read_edge_dst(elem))]
 
-				src_name = list_read(string_split(read_type(merged_model, src), "/"), 0)
-				dst_name = list_read(string_split(read_type(merged_model, dst), "/"), 0)
-
-				// Check if we actually keep both models around, as otherwise it is useless anyway
-				if (bool_and(dict_in(result, src_name), dict_in(result, dst_name))):
-					if (bool_and(dict_in(mapping, src), dict_in(mapping, dst))):
-						// All present, so create the link between them
-						Element src_model
-						Element dst_model
-
-						src_model = result[src_name]
-						dst_model = result[dst_name]
+				// All present, so create the link between them
+				src_name = list_pop_final(string_split(src, "/"))
+				dst_name = list_pop_final(string_split(dst, "/"))
 
-						source = reuse_element(tracability_model, "Reference", "", src_model["model"][mapping[src]])
-						target = reuse_element(tracability_model, "Reference", "", dst_model["model"][mapping[dst]])
+				source = instantiate_node(tracability_model, "Reference", "")
+				target = instantiate_node(tracability_model, "Reference", "")
+				instantiate_attribute(tracability_model, source, "name", src_name)
+				instantiate_attribute(tracability_model, target, "name", dst_name)
 
-						link = instantiate_link(tracability_model, "TracabilityLink", "", source, target)
-						instantiate_attribute(tracability_model, link, "type", type)
-					else:
-						// Not yet available!
-						set_add(second_keys, key)
+				link = instantiate_link(tracability_model, "TracabilityLink", "", source, target)
+				instantiate_attribute(tracability_model, link, "type", type)
 		else:
 			retyping_key = splitted[0]
 			if (list_len(string_split(key, "/")) > 1):

+ 3 - 2
bootstrap/tracability.mvc

@@ -1,12 +1,13 @@
 import models/SimpleClassDiagrams as SimpleClassDiagrams
 
 include "primitives.alh"
-include "object_operations.alh"
 
 SimpleClassDiagrams Tracability {
     SimpleAttribute String {}
 
-    Class Reference {}
+    Class Reference {
+        name : String
+    }
     Association TracabilityLink {
         type : String
     }