|
@@ -22,8 +22,8 @@ Element function instantiate_bottom():
|
|
|
new_model = create_node()
|
|
|
|
|
|
// Add an empty model and empty type mapping
|
|
|
- dict_add(new_model, "model", create_node())
|
|
|
- dict_add(new_model, "type_mapping", create_node())
|
|
|
+ dict_add_fast(new_model, "model", create_node())
|
|
|
+ dict_add_fast(new_model, "type_mapping", create_node())
|
|
|
|
|
|
// Return the created model
|
|
|
return new_model!
|
|
@@ -36,7 +36,7 @@ String function model_add_node(model : Element, name : String):
|
|
|
|
|
|
new_node = create_node()
|
|
|
actual_name = instantiated_name(new_node, name)
|
|
|
- dict_add(model["model"], actual_name, new_node)
|
|
|
+ dict_add_fast(model["model"], actual_name, new_node)
|
|
|
|
|
|
return actual_name!
|
|
|
|
|
@@ -45,7 +45,7 @@ String function model_add_value(model : Element, name : String, value : Element)
|
|
|
String actual_name
|
|
|
|
|
|
actual_name = instantiated_name(value, name)
|
|
|
- dict_add(model["model"], actual_name, value)
|
|
|
+ dict_add_fast(model["model"], actual_name, value)
|
|
|
|
|
|
return actual_name!
|
|
|
|
|
@@ -68,15 +68,15 @@ String function model_add_edge(model : Element, name : String, source : String,
|
|
|
|
|
|
new_edge = create_edge(model["model"][source], model["model"][destination])
|
|
|
actual_name = instantiated_name(new_edge, name)
|
|
|
- dict_add(model["model"], actual_name, new_edge)
|
|
|
+ dict_add_fast(model["model"], actual_name, new_edge)
|
|
|
|
|
|
return actual_name!
|
|
|
|
|
|
Void function retype_model(model : Element, metamodel : Element):
|
|
|
// Remove the type mapping and add a new one for the specified metamodel
|
|
|
dict_delete(model, "type_mapping")
|
|
|
- dict_add(model, "type_mapping", create_node())
|
|
|
- dict_add(model, "metamodel", metamodel)
|
|
|
+ dict_add_fast(model, "type_mapping", create_node())
|
|
|
+ dict_add_fast(model, "metamodel", metamodel)
|
|
|
return!
|
|
|
|
|
|
Void function retype(model : Element, element : String, type : String):
|
|
@@ -86,7 +86,7 @@ Void function retype(model : Element, element : String, type : String):
|
|
|
if (dict_in(model["type_mapping"], element)):
|
|
|
dict_delete(model["type_mapping"], element)
|
|
|
|
|
|
- dict_add(model["type_mapping"], element, type)
|
|
|
+ dict_add_fast(model["type_mapping"], element, type)
|
|
|
|
|
|
return!
|
|
|
|
|
@@ -442,23 +442,23 @@ Void function add_AL_links(model : Element, list : Element, element : Element, t
|
|
|
link_name = "__" + cast_id2s(link)
|
|
|
|
|
|
// The link
|
|
|
- dict_add(model["model"], link_name, link)
|
|
|
- dict_add(model["type_mapping"], link_name, (type + "_") + linkname)
|
|
|
+ dict_add_fast(model["model"], link_name, link)
|
|
|
+ dict_add_fast(model["type_mapping"], link_name, (type + "_") + linkname)
|
|
|
|
|
|
// The name link
|
|
|
link = read_out(link, 0)
|
|
|
link_name = "__" + cast_id2s(link)
|
|
|
|
|
|
- dict_add(model["model"], link_name, link)
|
|
|
- dict_add(model["type_mapping"], link_name, "dict_link_name")
|
|
|
+ dict_add_fast(model["model"], link_name, link)
|
|
|
+ dict_add_fast(model["type_mapping"], link_name, "dict_link_name")
|
|
|
|
|
|
// The name node
|
|
|
link = read_edge_dst(link)
|
|
|
link_name = "__" + cast_id2s(link)
|
|
|
|
|
|
if (bool_not(set_in_node(model["model"], link))):
|
|
|
- dict_add(model["model"], link_name, link)
|
|
|
- dict_add(model["type_mapping"], link_name, "StringAttr")
|
|
|
+ dict_add_fast(model["model"], link_name, link)
|
|
|
+ dict_add_fast(model["type_mapping"], link_name, "StringAttr")
|
|
|
|
|
|
// Now add the destination to the worker list
|
|
|
set_add(list, create_tuple(element[linkname], expected_type))
|
|
@@ -494,8 +494,8 @@ String function add_AL(model : Element, element : Element):
|
|
|
|
|
|
// Add the node itself
|
|
|
elem_name = "__" + cast_id2s(elem)
|
|
|
- dict_add(model["model"], elem_name, elem)
|
|
|
- dict_add(model["type_mapping"], elem_name, type)
|
|
|
+ dict_add_fast(model["model"], elem_name, elem)
|
|
|
+ dict_add_fast(model["type_mapping"], elem_name, type)
|
|
|
|
|
|
// Now add its edges
|
|
|
if (type == "if"):
|
|
@@ -559,7 +559,7 @@ Void function construct_model():
|
|
|
if (command == "instantiate_bottom"):
|
|
|
Element m
|
|
|
m = instantiate_bottom()
|
|
|
- dict_add(global_models, input(), m)
|
|
|
+ dict_add_fast(global_models, input(), m)
|
|
|
elif (command == "add_node"):
|
|
|
model_add_node(global_models[input()], input())
|
|
|
elif (command == "add_value"):
|
|
@@ -575,7 +575,7 @@ Void function construct_model():
|
|
|
elif (command == "instantiate_model"):
|
|
|
Element m
|
|
|
m = instantiate_model(global_models[input()])
|
|
|
- dict_add(global_models, input(), m)
|
|
|
+ dict_add_fast(global_models, input(), m)
|
|
|
elif (command == "instantiate_node"):
|
|
|
instantiate_node(global_models[input()], input(), input())
|
|
|
elif (command == "instantiate_attribute"):
|
|
@@ -603,7 +603,7 @@ Void function construct_model():
|
|
|
if (element_eq(m, read_root())):
|
|
|
log("Error: import not found for " + command)
|
|
|
else:
|
|
|
- dict_add(global_models, input(), m)
|
|
|
+ dict_add_fast(global_models, input(), m)
|
|
|
elif (command == "add_code_model"):
|
|
|
add_code_model(global_models[input()], input(), construct_function())
|
|
|
else:
|