Browse Source

Removed getName, which was deprecated for some time: replace by reverseKeyLookup

Yentl Van Tendeloo 9 years ago
parent
commit
309e86a15d

+ 0 - 3
bootstrap/object_operations.alc

@@ -181,6 +181,3 @@ String function print_dict(dict : Element):
 		result = result + cast_v2s(dict[key])
 		result = result + "\n"
 	return result
-
-String function getName(model : Element, element : Element):
-	return reverseKeyLookup(model["model"], element)

+ 8 - 8
integration/code/pn_interface.alc

@@ -74,7 +74,7 @@ Element function petrinet_fire(model : Element):
 			workset = allIncomingAssociationInstances(model, transition, "P2T")
 			while (0 < read_nr_out(workset)):
 				working_arc = set_pop(workset)
-				working_place = getName(model, read_edge_src(model["model"][working_arc]))
+				working_place = reverseKeyLookup(model["model"], read_edge_src(model["model"][working_arc]))
 				new_value = integer_subtraction(read_attribute(model, working_place, "tokens"), read_attribute(model, working_arc, "weight"))
 				unset_attribute(model, working_place, "tokens")
 				instantiate_attribute(model, working_place, "tokens", new_value)
@@ -84,7 +84,7 @@ Element function petrinet_fire(model : Element):
 			workset = allOutgoingAssociationInstances(model, transition, "T2P")
 			while (0 < read_nr_out(workset)):
 				working_arc = set_pop(workset)
-				working_place = getName(model, read_edge_dst(model["model"][working_arc]))
+				working_place = reverseKeyLookup(model["model"], read_edge_dst(model["model"][working_arc]))
 				new_value = integer_addition(read_attribute(model, working_place, "tokens"), read_attribute(model, working_arc, "weight"))
 				unset_attribute(model, working_place, "tokens")
 				instantiate_attribute(model, working_place, "tokens", new_value)
@@ -268,7 +268,7 @@ Element function model_loaded(model : Element):
 			while (read_nr_out(keys_m) > 0):
 				v_m = set_pop(keys_m)
 				// Filter out anonymous objects
-				typename = getName(model["metamodel"], dict_read_node(model["type_mapping"], model["model"][v_m]))
+				typename = reverseKeyLookup(model["metamodel"]["model"], dict_read_node(model["type_mapping"], model["model"][v_m]))
 				if (bool_not(string_startswith(v_m, "__"))):
 					output((("  " + v_m) + " : ") + typename)
 		elif (cmd == "read"):
@@ -280,10 +280,10 @@ Element function model_loaded(model : Element):
 				metamodel_element_pn = dict_read_node(model["type_mapping"], read_elem)
 
 				output("Name: " + cmd)
-				output("Type: " + getName(model["metamodel"], metamodel_element_pn))
+				output("Type: " + reverseKeyLookup(model["metamodel"]["model"], metamodel_element_pn))
 				if (is_edge(read_elem)):
-					output("Source: " + getName(model, read_edge_src(read_elem)))
-					output("Destination: " + getName(model, read_edge_dst(read_elem)))
+					output("Source: " + reverseKeyLookup(model["model"], read_edge_src(read_elem)))
+					output("Destination: " + reverseKeyLookup(model["model"], read_edge_dst(read_elem)))
 				if (cast_v2s(read_elem) != "None"):
 					output("Value: " + cast_v2s(read_elem))
 				output("Defines attributes:")
@@ -297,7 +297,7 @@ Element function model_loaded(model : Element):
 				attr_keys_pn = dict_keys(attr_list_pn)
 				while (0 < read_nr_out(attr_keys_pn)):
 					attr_key_pn = set_pop(attr_keys_pn)
-					output((((("  " + cast_v2s(attr_key_pn)) + " : ") + cast_v2s(attr_list_pn[attr_key_pn])) + " = ") + cast_v2s(read_attribute(model, getName(model, read_elem), attr_key_pn)))
+					output((((("  " + cast_v2s(attr_key_pn)) + " : ") + cast_v2s(attr_list_pn[attr_key_pn])) + " = ") + cast_v2s(read_attribute(model, reverseKeyLookup(model["model"], read_elem), attr_key_pn)))
 			else:
 				output("Unknown element; aborting")
 		elif (cmd == "verify"):
@@ -310,7 +310,7 @@ Element function model_loaded(model : Element):
 			while (read_nr_out(keys_t) > 0):
 				v_t = set_pop(keys_t)
 				if (bool_not(string_startswith(v_t, "__"))):
-					output(string_join(("  " + v_t) + " : ", getName(model["metamodel"]["metamodel"], dict_read_node(model["metamodel"]["type_mapping"], model["metamodel"]["model"][v_t]))))
+					output(string_join(("  " + v_t) + " : ", reverseKeyLookup(model["metamodel"]["metamodel"]["model"], dict_read_node(model["metamodel"]["type_mapping"], model["metamodel"]["model"][v_t]))))
 		elif (cmd == "retype"):
 			output("Element to retype?")
 			String elementname

+ 2 - 2
interface/HUTN/includes/conformance_scd.alh

@@ -1,5 +1,5 @@
-Boolean function is_direct_instance(model: Element, instance: Element, type: Element)
-Boolean function is_nominal_instance(model: Element, instance: Element, type: Element)
+Boolean function is_direct_instance(model: Element, instance: String, type: String)
+Boolean function is_nominal_instance(model: Element, instance: String, type: String)
 Boolean function is_structural_subtype(subtype: Element, supertype: Element)
 Element function conformance_scd(model: Element)
 Element function set_model_constraints(model: Element, func: Element)

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

@@ -4,7 +4,6 @@ Element function selectPossibleOutgoing(model : Element, source : String, limit_
 Element function allOutgoingAssociationInstances(model: Element, source_name : String, assoc_name: String)
 Element function allIncomingAssociationInstances(model: Element, target_name : String, assoc_name: String)
 Element function getAttributeList(model: Element, element: String)
-Element function getInstantiatableAttributes(model: Element, element: Element)
-String function getName(a: Element, b: Element)
+Element function getInstantiatableAttributes(model: Element, element: String)
 String function reverseKeyLookup(a: Element, b: Element)
 String function print_dict(dict : Element)