|
@@ -14,6 +14,8 @@ Element function allInstances(model : Element, type_name : String):
|
|
|
type = model["metamodel"]["model"][type_name]
|
|
|
result = create_node()
|
|
|
|
|
|
+ // TODO more efficient to work backwards: find all instances of an element through the type mapping directly
|
|
|
+ // must then take into account all inheritance links ourselves...
|
|
|
while (0 < list_len(keys)):
|
|
|
key = set_pop(keys)
|
|
|
if (is_nominal_instance(model, key, type_name)):
|
|
@@ -64,19 +66,22 @@ Element function selectPossibleOutgoing(model : Element, source : String, limit_
|
|
|
|
|
|
Element function allOutgoingAssociationInstances(model : Element, source_name : String, assoc_name : String):
|
|
|
// Read out all outgoing edges of the model and select those that are typed by the specified association
|
|
|
- Element assocs
|
|
|
- String assoc
|
|
|
Element result
|
|
|
Element source
|
|
|
+ String option
|
|
|
+ Integer all_out
|
|
|
+ Integer i
|
|
|
|
|
|
- assocs = allInstances(model, assoc_name)
|
|
|
+ result = create_node()
|
|
|
source = model["model"][source_name]
|
|
|
+ all_out = read_nr_out(source)
|
|
|
+ i = 0
|
|
|
+ while (i < all_out):
|
|
|
+ option = reverseKeyLookup(model["model"], read_out(source, i))
|
|
|
+ if (is_nominal_instance(model, option, assoc_name)):
|
|
|
+ set_add(result, option)
|
|
|
+ i = i + 1
|
|
|
|
|
|
- result = create_node()
|
|
|
- while (0 < list_len(assocs)):
|
|
|
- assoc = set_pop(assocs)
|
|
|
- if (element_eq(source, read_edge_src(model["model"][assoc]))):
|
|
|
- set_add(result, assoc)
|
|
|
return result!
|
|
|
|
|
|
Element function allIncomingAssociationInstances(model : Element, target_name : String, assoc_name : String):
|