|
@@ -6,7 +6,7 @@ Element function allInstances(model : Element, type : Element):
|
|
|
Element type_mapping
|
|
|
Element result
|
|
|
|
|
|
- type_mapping = dict_read(model, "type_mapping")
|
|
|
+ type_mapping = model["type_mapping"]
|
|
|
result = create_node()
|
|
|
|
|
|
Integer counter
|
|
@@ -25,25 +25,25 @@ Element function allInstances(model : Element, type : Element):
|
|
|
|
|
|
return result
|
|
|
|
|
|
-Element function allOutgoingAssociationInstances(model_aoai : Element, source_aoai : Element, assoc_aoai : Element):
|
|
|
+Element function allOutgoingAssociationInstances(model : Element, source : Element, assoc : Element):
|
|
|
// Read out all outgoing edges of the model and select those that are typed by the specified association
|
|
|
// TODO for some reason this crashes if allInstances is used!
|
|
|
- Integer length_aoai
|
|
|
- length_aoai = read_nr_out(source_aoai)
|
|
|
+ Integer length
|
|
|
+ length = read_nr_out(source)
|
|
|
|
|
|
- Integer counter_aoai
|
|
|
- counter_aoai = 0
|
|
|
+ Integer counter
|
|
|
+ counter = 0
|
|
|
|
|
|
- Element result_aoai
|
|
|
- result_aoai = create_node()
|
|
|
+ Element result
|
|
|
+ result = create_node()
|
|
|
|
|
|
- Element edge_aoai
|
|
|
- while (counter_aoai < length_aoai):
|
|
|
- edge_aoai = read_out(source_aoai, counter_aoai)
|
|
|
- if (element_eq(dict_read_node(dict_read(model_aoai, "type_mapping"), edge_aoai), assoc_aoai)):
|
|
|
- set_add(result_aoai, edge_aoai)
|
|
|
- counter_aoai = counter_aoai + 1
|
|
|
- return result_aoai
|
|
|
+ Element edge
|
|
|
+ while (counter < length):
|
|
|
+ edge = read_out(source, counter)
|
|
|
+ if (element_eq(dict_read_node(model["type_mapping"], edge), assoc)):
|
|
|
+ set_add(result, edge)
|
|
|
+ counter = counter + 1
|
|
|
+ return result
|
|
|
|
|
|
Element function allIncomingAssociationInstances(model : Element, source : Element, assoc : Element):
|
|
|
// Read out all outgoing edges of the model and select those that are typed by the specified association
|
|
@@ -60,7 +60,7 @@ Element function allIncomingAssociationInstances(model : Element, source : Eleme
|
|
|
return result
|
|
|
|
|
|
Element function readElementByName(model : Element, name : String):
|
|
|
- return dict_read(dict_read(model, "model"), name)
|
|
|
+ return model["model"][name]
|
|
|
|
|
|
Element function findAttribute(source : Element, attr_name : Element, types : Element, inheritance_link : Element):
|
|
|
if (dict_in(source, attr_name)):
|
|
@@ -82,7 +82,7 @@ Element function findAttribute(source : Element, attr_name : Element, types : El
|
|
|
Element function readAttribute(model : Element, source : Element, attr_name : String):
|
|
|
// Read out the edge we are talking about
|
|
|
Element edge
|
|
|
- edge = findAttribute(dict_read_node(dict_read(model, "type_mapping"), source), attr_name, dict_read(model, "type_mapping"), dict_read(model, "inheritance"))
|
|
|
+ edge = findAttribute(dict_read_node(model["type_mapping"], source), attr_name, model["type_mapping"], model["inheritance"])
|
|
|
|
|
|
return read_edge_dst(set_pop(allOutgoingAssociationInstances(model, source, edge)))
|
|
|
|
|
@@ -94,8 +94,8 @@ Element function setAttribute(model : Element, source : Element, attr_name : Str
|
|
|
// Now make the element
|
|
|
Element created_edge
|
|
|
created_edge = create_edge(source, value)
|
|
|
- dict_add(dict_read(model, "type_mapping"), created_edge, edge)
|
|
|
- dict_add(dict_read(model, "type_mapping"), value, read_edge_dst(edge))
|
|
|
+ dict_add(model["type_mapping"], created_edge, edge)
|
|
|
+ dict_add(model["type_mapping"], value, read_edge_dst(edge))
|
|
|
add_to_model(model, "", value)
|
|
|
add_to_model(model, "", created_edge)
|
|
|
|
|
@@ -103,7 +103,7 @@ Element function setAttribute(model : Element, source : Element, attr_name : Str
|
|
|
|
|
|
Element function deleteAttribute(model : Element, source : Element, attr_name : Element):
|
|
|
Element edge
|
|
|
- edge = findAttribute(dict_read_node(dict_read(model, "type_mapping"), source), attr_name, dict_read(model, "type_mapping"), dict_read(model, "inheritance"))
|
|
|
+ edge = findAttribute(dict_read_node(model["type_mapping"], source), attr_name, model["type_mapping"], model["inheritance"])
|
|
|
|
|
|
Element found_elements
|
|
|
found_elements = allOutgoingAssociationInstances(model, source, edge)
|
|
@@ -111,7 +111,7 @@ Element function deleteAttribute(model : Element, source : Element, attr_name :
|
|
|
Element rm_element
|
|
|
if (list_len(found_elements) > 0):
|
|
|
rm_element = read_edge_dst(set_pop(found_elements))
|
|
|
- dict_delete(dict_read(model, "type_mapping"), rm_element)
|
|
|
+ dict_delete(model["type_mapping"], rm_element)
|
|
|
delete_element(rm_element)
|
|
|
|
|
|
return edge
|
|
@@ -128,13 +128,13 @@ Element function getAttributeList(model : Element, mm : Element):
|
|
|
while (0 < read_nr_out(set_own)):
|
|
|
e = set_pop(set_own)
|
|
|
if (typeof(e) == String):
|
|
|
- if (typeof(dict_read(mm, e)) == Type):
|
|
|
+ if (typeof(mm[e]) == Type):
|
|
|
// This is a primitive type, so add to the list
|
|
|
- dict_add(result, e, dict_read(mm, e))
|
|
|
+ dict_add(result, e, mm[e])
|
|
|
|
|
|
// And go up to the possible supertypes
|
|
|
Element found_elements
|
|
|
- found_elements = allOutgoingAssociationInstances(model, mm, dict_read(model, "inheritance"))
|
|
|
+ found_elements = allOutgoingAssociationInstances(model, mm, model["inheritance"])
|
|
|
Element dict_super
|
|
|
Integer i
|
|
|
Integer max
|
|
@@ -147,7 +147,7 @@ Element function getAttributeList(model : Element, mm : Element):
|
|
|
// Merge the two
|
|
|
while (0 < read_nr_out(set_super)):
|
|
|
found_key = set_pop(set_super)
|
|
|
- dict_add(result, found_key, dict_read(dict_super, found_key))
|
|
|
+ dict_add(result, found_key, dict_super[found_key])
|
|
|
|
|
|
return result
|
|
|
|
|
@@ -162,16 +162,16 @@ Element function getInstantiatableAttributes(model : Element, element : Element)
|
|
|
Element e
|
|
|
while (0 < read_nr_out(set_own)):
|
|
|
e = set_pop(set_own)
|
|
|
- if (bool_and(typeof(e) == String, typeof(dict_read(element, e)) == Type)):
|
|
|
+ if (bool_and(typeof(e) == String, typeof(element[e]) == Type)):
|
|
|
// This is a primitive type, so add to the list
|
|
|
- dict_add(result, e, dict_read(element, e))
|
|
|
+ dict_add(result, e, element[e])
|
|
|
|
|
|
return result
|
|
|
|
|
|
String function getName(m : Element, e : Element):
|
|
|
Element element_keys
|
|
|
Element s
|
|
|
- s = dict_read(m, "model")
|
|
|
+ s = m["model"]
|
|
|
element_keys = dict_keys(s)
|
|
|
|
|
|
Element key
|