浏览代码

updated printNode method with metatype info and if edge destination metatype info (usefull for testing if an element is related to attribute or not)

tpinna 10 年之前
父节点
当前提交
018b20de0e
共有 1 个文件被更改,包括 18 次插入 和 4 次删除
  1. 18 4
      integration/code/pn_interface.alc

+ 18 - 4
integration/code/pn_interface.alc

@@ -20,18 +20,30 @@ Element function find_attribute_type_s(model : Element, elem : String, name : St
 	else:
 		return getName(model["metamodel"], read_edge_dst( dict_read_edge(mm_elem, name)))
 
+Element function getTypeName(model:Element, node:Element):
+	return getName(model["metamodel"], dict_read_node(model["type_mapping"], node))
 
+Element function getMetaTypeName(model:Element, node:Element):
+	return getTypeName(model["metamodel"], dict_read_node(model["type_mapping"], node))
 
 //function to print information about a node (attributes, type and name)
 Element function printNode(tf_pn_model: Element, tf_pn_node: Element):
 	
-	//print header with name and type
+	//print header with name, metatype
 	
+	//print node_name
 	String tf_pn_node_name
 	tf_pn_node_name = getName(tf_pn_model, tf_pn_node)
-	log(string_join("name: ",tf_pn_node_name) )
-	log(string_join("type: ", getName(tf_pn_model["metamodel"], dict_read_node(tf_pn_model["type_mapping"], tf_pn_node)) ))
-	//log(getName(tf_pn_model["metamodel"], dict_read_node(tf_pn_model["type_mapping"], tf_pn_node)))
+	log(string_join("--name: ",tf_pn_node_name) )
+	//print node type
+	log(string_join("type: ", getTypeName(tf_pn_model, tf_pn_node) ))
+	//print node metatype
+	String metatype
+	metatype = getMetaTypeName(tf_pn_model, tf_pn_node)
+	log(string_join("metatype: ",  metatype))
+	if (metatype == "l5"):
+		log(string_join("dest_metatype: ",  getMetaTypeName(tf_pn_model, read_edge_dst(tf_pn_node))))
+	
 	
 	//print attributes
 	
@@ -82,6 +94,7 @@ Element function tf_matchAll(tf_ma_transformation: Element, tf_ma_pattern : Elem
 	Element tf_ma_ramified_node
 	while (integer_lt(0, list_len(tf_ma_pattern_edges))):
 		tf_ma_ramified_node = read_edge_dst(set_pop(tf_ma_pattern_edges))
+		printNode(tf_ma_transformation, tf_ma_ramified_node)
 		set_add(tf_ma_ramified_nodes, tf_ma_ramified_node)
 	
 	//find all nodes in the graph
@@ -103,6 +116,7 @@ Element function tf_matchAll(tf_ma_transformation: Element, tf_ma_pattern : Elem
 	Element host_model_key
 	while (integer_lt(0, read_nr_out(hostmodel_keys))):
 		host_model_key = set_pop(hostmodel_keys)
+		printNode(tf_ma_model, tf_ma_model["model"][host_model_key])
 		set_add(host_nodes, tf_ma_model["model"][host_model_key])
 	
 	// initialise the start-state