|
@@ -70,45 +70,40 @@ Element function allOutgoingAssociationInstances(model : Element, source_name :
|
|
|
// 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!
|
|
|
|
|
|
- Element assoc
|
|
|
- Element source
|
|
|
- source = model["model"][source_name]
|
|
|
- assoc = model["metamodel"]["model"][assoc_name]
|
|
|
-
|
|
|
- Integer length
|
|
|
- length = read_nr_out(source)
|
|
|
-
|
|
|
- Integer counter
|
|
|
- counter = 0
|
|
|
-
|
|
|
+ Integer nr_out
|
|
|
+ Integer i
|
|
|
+ Element out
|
|
|
+ String out_name
|
|
|
Element result
|
|
|
- result = create_node()
|
|
|
|
|
|
- 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
|
|
|
+ result = create_node()
|
|
|
+ nr_out = read_nr_out(model["model"][source_name])
|
|
|
+ i = 0
|
|
|
+ while (i < nr_out):
|
|
|
+ out = read_out(model["model"][source_name], i)
|
|
|
+ out_name = reverseKeyLookup(model["model"], out)
|
|
|
+ if (is_nominal_instance(model, out, model["metamodel"]["model"][assoc_name])):
|
|
|
+ set_add(result, out_name)
|
|
|
+ i = i + 1
|
|
|
return result
|
|
|
|
|
|
-Element function allIncomingAssociationInstances(model : Element, target_name : Element, assoc_name : Element):
|
|
|
+Element function allIncomingAssociationInstances(model : Element, target_name : String, assoc_name : String):
|
|
|
// Read out all outgoing edges of the model and select those that are typed by the specified association
|
|
|
- Element assoc
|
|
|
- Element target
|
|
|
- target = model["model"][target_name]
|
|
|
- assoc = model["metamodel"]["model"][assoc_name]
|
|
|
-
|
|
|
+ Integer nr_in
|
|
|
+ Integer i
|
|
|
+ Element in
|
|
|
+ String in_name
|
|
|
Element result
|
|
|
+
|
|
|
result = create_node()
|
|
|
- Element allinsts
|
|
|
- allinsts = allInstances(model, assoc)
|
|
|
-
|
|
|
- Element understudy
|
|
|
- while (0 < read_nr_out(allinsts)):
|
|
|
- understudy = set_pop(allinsts)
|
|
|
- if (element_eq(read_edge_dst(understudy), target)):
|
|
|
- set_add(result, understudy)
|
|
|
+ nr_in = read_nr_in(model["model"][target_name])
|
|
|
+ i = 0
|
|
|
+ while (i < nr_in):
|
|
|
+ in = read_out(model["model"][target_name], i)
|
|
|
+ in_name = reverseKeyLookup(model["model"], in)
|
|
|
+ if (is_nominal_instance(model, in, model["metamodel"]["model"][assoc_name])):
|
|
|
+ set_add(result, in_name)
|
|
|
+ i = i + 1
|
|
|
return result
|
|
|
|
|
|
Element function readElementByName(model : Element, name : String):
|