|
@@ -1,28 +1,6 @@
|
|
|
include "primitives.alh"
|
|
|
include "utils.alh"
|
|
|
|
|
|
-Element function get_type_mapping_as_dict(model : Element):
|
|
|
- NEW_get_type_mapping_as_dict(model)
|
|
|
- return OLD_get_type_mapping_as_dict(model)!
|
|
|
-
|
|
|
-String function read_type(model : Element, name : String):
|
|
|
- NEW_read_type(model, name)
|
|
|
- return OLD_read_type(model, name)!
|
|
|
-
|
|
|
-Void function retype(model : Element, element : String, type : String):
|
|
|
- NEW_retype(model, element, type)
|
|
|
- OLD_retype(model, element, type)
|
|
|
- return!
|
|
|
-
|
|
|
-Void function new_type_mapping(model : Element):
|
|
|
- NEW_new_type_mapping(model)
|
|
|
- OLD_new_type_mapping(model)
|
|
|
- return!
|
|
|
-
|
|
|
-Void function remove_type(model : Element, name : String):
|
|
|
- OLD_remove_type(model, name)
|
|
|
- return!
|
|
|
-
|
|
|
Element function get_type_mapping(model : Element):
|
|
|
return model["type_mapping"]!
|
|
|
|
|
@@ -30,7 +8,7 @@ Void function set_type_mapping(model : Element, type_mapping : Element):
|
|
|
dict_overwrite(model, "type_mapping", type_mapping)
|
|
|
return!
|
|
|
|
|
|
-Element function NEW_get_type_mapping_as_dict(model : Element):
|
|
|
+Element function get_type_mapping_as_dict(model : Element):
|
|
|
Element dict
|
|
|
Element keys
|
|
|
String key
|
|
@@ -49,11 +27,11 @@ Element function NEW_get_type_mapping_as_dict(model : Element):
|
|
|
// Element is in neither model or metamodel
|
|
|
// Must be a typing link!
|
|
|
// So add it
|
|
|
- dict_add_fast(dict, dict_read_node(rev_model, read_edge_src(model["type_mapping"][key])), dict_read_node(rev_metamodel, read_edge_dst(model["type_mapping"][key])))
|
|
|
+ dict_add_fast(dict, rev_model[cast_id2s(read_edge_src(model["type_mapping"][key]))], rev_metamodel[cast_id2s(read_edge_dst(model["type_mapping"][key]))])
|
|
|
|
|
|
return dict!
|
|
|
|
|
|
-String function NEW_read_type(model : Element, name : String):
|
|
|
+String function read_type(model : Element, name : String):
|
|
|
Element m_element
|
|
|
Element link
|
|
|
Integer nr
|
|
@@ -78,9 +56,9 @@ String function NEW_read_type(model : Element, name : String):
|
|
|
// Nothing found, so it must not be typed at all
|
|
|
return ""!
|
|
|
|
|
|
-Void function NEW_retype(model : Element, element : String, type : String):
|
|
|
+Void function retype(model : Element, element : String, type : String):
|
|
|
// Remove previous type
|
|
|
- //NEW_remove_type(model, element)
|
|
|
+ remove_type(model, element)
|
|
|
|
|
|
// Add element of the model
|
|
|
dict_add_fast(model["type_mapping"], cast_id2s(model["model"][element]), model["model"][element])
|
|
@@ -98,7 +76,7 @@ Void function NEW_retype(model : Element, element : String, type : String):
|
|
|
|
|
|
return!
|
|
|
|
|
|
-Void function NEW_new_type_mapping(model : Element):
|
|
|
+Void function new_type_mapping(model : Element):
|
|
|
if (dict_in(model, "type_mapping")):
|
|
|
dict_delete(model, "type_mapping")
|
|
|
|
|
@@ -106,7 +84,7 @@ Void function NEW_new_type_mapping(model : Element):
|
|
|
|
|
|
return !
|
|
|
|
|
|
-Void function NEW_remove_type(model : Element, name : String):
|
|
|
+Void function remove_type(model : Element, name : String):
|
|
|
String elem
|
|
|
|
|
|
elem = cast_id2s(model["model"][name])
|
|
@@ -114,43 +92,3 @@ Void function NEW_remove_type(model : Element, name : String):
|
|
|
dict_delete(model["type_mapping"], elem)
|
|
|
|
|
|
return !
|
|
|
-
|
|
|
-Element function OLD_get_type_mapping_as_dict(model : Element):
|
|
|
- return model["type_mapping"][""]!
|
|
|
-
|
|
|
-Element function OLD_get_elements_typed_by(model : Element, type : String):
|
|
|
- return reverseKeyLookupMulti(model["type_mapping"][""], type)!
|
|
|
-
|
|
|
-String function OLD_read_type(model : Element, name : String):
|
|
|
- String result
|
|
|
- Element tm
|
|
|
- if (dict_in(model["model"], name)):
|
|
|
- if (dict_in(model["type_mapping"][""], name)):
|
|
|
- result = model["type_mapping"][""][name]
|
|
|
- if (dict_in(model["metamodel"]["model"], result)):
|
|
|
- return result!
|
|
|
- else:
|
|
|
- return ""!
|
|
|
- else:
|
|
|
- return ""!
|
|
|
- else:
|
|
|
- return ""!
|
|
|
-
|
|
|
-Void function OLD_retype(model : Element, element : String, type : String):
|
|
|
- // Retype a model, deleting any previous type the element had
|
|
|
- // The type string is evaluated in the metamodel previously specified
|
|
|
- if (dict_in(model["type_mapping"][""], element)):
|
|
|
- dict_delete(model["type_mapping"][""], element)
|
|
|
- dict_add_fast(model["type_mapping"][""], element, type)
|
|
|
- return!
|
|
|
-
|
|
|
-Void function OLD_new_type_mapping(model : Element):
|
|
|
- if (dict_in(model, "type_mapping")):
|
|
|
- dict_delete(model, "type_mapping")
|
|
|
- dict_add_fast(model, "type_mapping", dict_create())
|
|
|
- dict_add_fast(model["type_mapping"], "", dict_create())
|
|
|
- return !
|
|
|
-
|
|
|
-Void function OLD_remove_type(model : Element, name : String):
|
|
|
- dict_delete(model["type_mapping"][""], name)
|
|
|
- return !
|