Parcourir la source

moved get superclasses method

tpinna il y a 10 ans
Parent
commit
7fb4ef0911

+ 1 - 22
bootstrap/modelling.alc

@@ -104,28 +104,7 @@ Element function find_attribute_type(model : Element, elem : String, name : Stri
 	else:
 		return getName(model["metamodel"], dict_read_edge(mm_elem, name))
 
-Element function get_superclasses(model : Element, elem : Element):
-	Element result
-	Integer i
-	Integer num_edges
-	Element edge
-
-	// Initialize empty set
-	result = create_node()
-	i = 0
-
-	// Read out all outgoing edges
-	num_edges = read_nr_out(elem)
-	//log(cast_i2s(num_edges))
-	while (i < num_edges):
-		//log("Search SC")
-		edge = read_out(elem, i)
-		//log(cast_e2s(edge))
-		if (element_eq(dict_read_node(model["type_mapping"], edge), model["inheritance"])):
-			create_edge(result, read_edge_dst(edge))
-		i = i + 1
-
-	return result
+
 
 Element function find_attribute_definer(model : Element, elem : Element, name : String):
 	if (dict_in(elem, name)):

+ 23 - 0
bootstrap/object_operations.alc

@@ -62,6 +62,29 @@ Element function allIncomingAssociationInstances(model : Element, source : Eleme
 Element function readElementByName(model : Element, name : String):
 	return model["model"][name]
 
+Element function get_superclasses(model : Element, elem : Element):
+	Element result
+	Integer i
+	Integer num_edges
+	Element edge
+
+	// Initialize empty set
+	result = create_node()
+	i = 0
+
+	// Read out all outgoing edges
+	num_edges = read_nr_out(elem)
+	//log(cast_i2s(num_edges))
+	while (i < num_edges):
+		//log("Search SC")
+		edge = read_out(elem, i)
+		//log(cast_e2s(edge))
+		if (element_eq(dict_read_node(model["type_mapping"], edge), model["inheritance"])):
+			create_edge(result, read_edge_dst(edge))
+		i = i + 1
+
+	return result
+
 Element function getAttributeList(model : Element, element : String):
 	Element result
 	Element keys

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

@@ -8,7 +8,6 @@ Void function retype(model : Element, element : String, type : String)
 Element function instantiate_model(metamodel : Element)
 String function instantiate_node(model : Element, type_name : String, instance_name : String)
 Element function find_attribute_type(model : Element, elem : String, name : String)
-Element function get_superclasses(model : Element, elem : Element)
 Element function find_attribute_definer(model : Element, elem : Element, name : String)
 Void function instantiate_attribute(model : Element, element : String, attribute_name : String, value : Element)
 String function instantiate_link(model : Element, type : String, name : String, source : String, destination : String)

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

@@ -7,3 +7,4 @@ Element function getInstantiatableAttributes(a: Element, b: Element)
 String function getName(a: Element, b: Element)
 String function reverseNameLookup(a: Element, b: Element)
 String function print_dict(dict : Element)
+Element function get_superclasses(model : Element, elem : Element)