Browse Source

Fixed reverseKeyLookupMulti in AL

Yentl Van Tendeloo 7 years ago
parent
commit
cd2aaa3975
2 changed files with 5 additions and 9 deletions
  1. 4 8
      bootstrap/semi_primitives.alc
  2. 1 1
      wrappers/modelverse_SCCD.py

+ 4 - 8
bootstrap/semi_primitives.alc

@@ -404,7 +404,6 @@ Element function set_in_node(a: Element, b: Element):
 	return dict_in_node(a, b)!
 
 String function reverseKeyLookup(dict : Element, element : Element):
-	// TODO don't know if this AL will actually work...
 	Integer nr_in
 	Integer nr_out
 	Integer counter
@@ -422,21 +421,18 @@ String function reverseKeyLookup(dict : Element, element : Element):
 	return ""!
 
 Element function reverseKeyLookupMulti(dict : Element, element : Element):
-	// TODO don't know if this AL will actually work...
-	Integer nr_in
 	Integer nr_out
 	Integer counter
 	Element link
 	Element result
 
 	result = set_create()
-	nr_in = read_nr_in(element)
+	nr_out = read_nr_out(dict)
 	counter = 0
-	while (counter < nr_in):
-		if (element_eq(read_edge_src(read_in(element, counter)), dict)):
+	while (counter < nr_out):
+		if (value_eq(read_edge_dst(read_out(dict, counter)), element)):
 			// Got a match
-			set_add(result, read_edge_dst(read_out(read_in(element, counter), 0)))
-
+			set_add(result, read_edge_dst(read_out(read_out(dict, counter), 0)))
 		counter = counter + 1
 	
 	return result!

+ 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 Apr 25 07:24:20 2018
+Date:   Wed Apr 25 09:27:00 2018
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server