Browse Source

Nothin works: checking what changed

tpinna 10 years ago
parent
commit
96585f5949
1 changed files with 16 additions and 11 deletions
  1. 16 11
      integration/code/pn_interface.alc

+ 16 - 11
integration/code/pn_interface.alc

@@ -86,9 +86,8 @@ Boolean function node_match(transf_model : Element, transf_elem : Element, host_
 	type2 = string_join(getTypeName(host_model, host_elem), "_LHS")
 	if (type1 != type2):
 		return False
-	log("--> matched")
-	log(string_join(string_join(type1, " : "), getName(transf_model, transf_elem)))
-	log(string_join(string_join(type2, " : "), getName(host_model, host_elem)))
+	//log(string_join(string_join(type1, " : "), getName(transf_model, transf_elem)))
+	//log(string_join(string_join(type2, " : "), getName(host_model, host_elem)))
 	return True
 
 Integer function are_connected(model: Element, el1:Element, el2:Element):
@@ -100,9 +99,9 @@ Integer function are_connected(model: Element, el1:Element, el2:Element):
 		if(el2_mmt == "Class"):
 			return False //not connected, no edge inbetween
 		elif(el2_mmt == "l5"):
-			if( read_edge_src(el2) == el1): //warning is this the right type of equality?
+			if( element_eq(read_edge_src(el2) , el1)): //warning is this the right type of equality?
 				return 1 //outgoing
-			elif( read_edge_dst(el2) == el1): //right type of equality?
+			elif( element_eq(read_edge_dst(el2) , el1)): //right type of equality?
 				return 2 //incoming
 			else:
 				return 0 //the edge is not connected
@@ -110,9 +109,9 @@ Integer function are_connected(model: Element, el1:Element, el2:Element):
 			log("is_connected_to: unsupported type for second element")
 			log(string_join("type = ", el2_mmt))
 	elif (el1_mmt == "l5"):
-		if( read_edge_src(el1) == el2): //warning is this the right type of equality?
+		if( element_eq(read_edge_src(el1) , el2)): //warning is this the right type of equality?
 			return 2 //incoming
-		elif( read_edge_dst(el1) == el2): //right type of equality?
+		elif( element_eq(read_edge_dst(el1) , el2)): //right type of equality?
 			return 1 //outgoing
 		else:
 			return 0 //edge is not connected
@@ -225,7 +224,11 @@ Element function new_SearchState(OldSearchState : Element, TransfModel : Element
 		elem = list_read(ol, index)
 		index = index + 1
 		if(bool_not(element_eq(elem, NewHostElem))):
+			log("= connectedness")
+			log(getName(HostModel, elem))
+			log(getName(HostModel, NewHostElem))
 			connectedness = are_connected(HostModel, NewHostElem, elem)
+			log(cast_i2s(connectedness))
 			if (connectedness == 0): // if not connected, keep in V
 				list_append(nl, elem) 
 			elif (connectedness == 1): //if connected in outwards manner, don't keep in v and add to outlist
@@ -255,9 +258,7 @@ Element function transf_vf2(SearchState: Element, transf_m : Element, host_m : E
 	Integer pattern_size
 	pattern_size = SearchState["pattern_size"]
 	if pattern_size == list_len(current_match):
-		log("match found")
 		set_add(SearchState["matches"], SearchState["curmatch"])
-		log(cast_i2s(list_len(SearchState["matches"])))
 		return SearchState
 	
 	//feasability checks
@@ -286,7 +287,9 @@ Element function transf_vf2(SearchState: Element, transf_m : Element, host_m : E
 			index2= index2 + 1
 			if(node_match(transf_m, pattern_node, host_m, host_node)):
 				nss = new_SearchState(SearchState, transf_m, pattern_node, host_m, host_node)
-				transf_vf2(nss, transf_m, host_m)
+				nss = transf_vf2(nss, transf_m, host_m)
+				dict_delete(SearchState, "matches")
+				dict_add(SearchState, "matches", nss["matches"])
 	elif ( list_len(SearchState["N_pattern_in"]) > 0 ):
 		//check for candidates in (N_pattern_in, N_host_in)
 		host_list = SearchState["N_host_in"]
@@ -297,7 +300,9 @@ Element function transf_vf2(SearchState: Element, transf_m : Element, host_m : E
 			index2= index2 + 1
 			if(node_match(transf_m, pattern_node, host_m, host_node)):
 				nss = new_SearchState(SearchState, transf_m, pattern_node, host_m, host_node)
-				transf_vf2(nss, transf_m, host_m)
+				nss = transf_vf2(nss, transf_m, host_m)
+				dict_delete(SearchState, "matches")
+				dict_add(SearchState, "matches", nss["matches"])
 	elif ( list_len(SearchState["V_pattern"]) > 0 ):
 		//check for candidates in (V_pattern, V_host))
 		host_list = SearchState["V_host"]