Browse Source

Added new "followAssociation" function

Yentl Van Tendeloo 9 years ago
parent
commit
795f8ddfa0
2 changed files with 13 additions and 0 deletions
  1. 12 0
      bootstrap/object_operations.alc
  2. 1 0
      interface/HUTN/includes/object_operations.alh

+ 12 - 0
bootstrap/object_operations.alc

@@ -169,3 +169,15 @@ String function readAssociationSource(model : Element, name : String):
 
 String function readAssociationDestination(model : Element, name : String):
 	return reverseKeyLookup(model["model"], read_edge_dst(model["model"][name]))
+
+String function followAssociation(model : Element, element_name : String, association_name : String):
+	Element assocs
+	String assoc
+	Element result
+
+	assocs = allOutgoingAssociationInstances(model, element_name, association_name)
+	result = create_node()
+	while (0 < list_len(assocs)):
+		set_add(result, readAssociationDestination(model, set_pop(assocs)))
+
+	return result

+ 1 - 0
interface/HUTN/includes/object_operations.alh

@@ -9,3 +9,4 @@ String function reverseKeyLookup(a: Element, b: Element)
 String function print_dict(dict : Element)
 String function readAssociationSource(model : Element, name : String)
 String function readAssociationDestination(model : Element, name : String)
+String function followAssociation(model : Element, element_name : String, association_name : String)