|
@@ -94,8 +94,46 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
|
|
|
log("ERROR: unbound source/target for association!")
|
|
|
return create_node()!
|
|
|
else:
|
|
|
- // Is a node, so check for already bound incoming/outgoing
|
|
|
- options = allInstances(host_model, original_typename)
|
|
|
+ // Is a node, so find whether or not there are some connections that are already resolved
|
|
|
+ // TODO check implementation
|
|
|
+ Element ic
|
|
|
+ Element oc
|
|
|
+ String poll
|
|
|
+
|
|
|
+ log("Finding in/out for " + current_element)
|
|
|
+ log("Current mapping: " + set_to_string(map))
|
|
|
+ ic = allIncomingAssociationInstances(schedule_model, current_element, "Pre_Element")
|
|
|
+ oc = allOutgoingAssociationInstances(schedule_model, current_element, "Pre_Element")
|
|
|
+
|
|
|
+ log("Incoming: " + set_to_string(ic))
|
|
|
+ log("Outgoing: " + set_to_string(oc))
|
|
|
+
|
|
|
+ log("Check incoming")
|
|
|
+ while (bool_and(read_nr_out(ic) > 0, read_nr_out(options) == 0)):
|
|
|
+ poll = set_pop(ic)
|
|
|
+ log("Checking if already bound " + poll)
|
|
|
+ if (dict_in(map, read_attribute(schedule_model, poll, "label"))):
|
|
|
+ // This incoming link is already defined, so we just have one option: the destination of the link we matched
|
|
|
+ log("Got match!")
|
|
|
+ set_add(options, readAssociationDestination(host_model, map[read_attribute(schedule_model, poll, "label")]))
|
|
|
+
|
|
|
+ log("Check outgoing")
|
|
|
+ while (bool_and(read_nr_out(oc) > 0, read_nr_out(options) == 0)):
|
|
|
+ poll = set_pop(oc)
|
|
|
+ log("Checking if already bound " + poll)
|
|
|
+ if (dict_in(map, read_attribute(schedule_model, poll, "label"))):
|
|
|
+ // This incoming link is already defined, so we just have one option: the destination of the link we matched
|
|
|
+ log("Got match!")
|
|
|
+ set_add(options, readAssociationSource(host_model, map[read_attribute(schedule_model, poll, "label")]))
|
|
|
+
|
|
|
+ if (read_nr_out(options) == 0):
|
|
|
+ // Is a node and no connections, so we just pick all options
|
|
|
+ log("NO, so find new instances anyway")
|
|
|
+ options = allInstances(host_model, original_typename)
|
|
|
+ else:
|
|
|
+ log("YES, so got instance already")
|
|
|
+
|
|
|
+ log("Returned options: " + set_to_string(options))
|
|
|
|
|
|
// Filter options further
|
|
|
Element filtered_options
|
|
@@ -104,6 +142,7 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
|
|
|
filtered_options = create_node()
|
|
|
while (read_nr_out(options) > 0):
|
|
|
option = set_pop(options)
|
|
|
+
|
|
|
// Check for detecting same element twice
|
|
|
if (bool_not(set_in(map, option))):
|
|
|
// Option is already present with another label, so skip this!
|
|
@@ -365,6 +404,7 @@ Boolean function transform_forall(host_model : Element, schedule_model : Element
|
|
|
|
|
|
while (read_nr_out(mappings) > 0):
|
|
|
mapping = set_pop(mappings)
|
|
|
+ log("Apply for mapping: " + dict_to_string(mapping))
|
|
|
// TODO check if there are actually no deletions happening in the meantime of other matched elements...
|
|
|
RHS = set_pop(allAssociationDestinations(schedule_model, current, "AtomicRHS"))
|
|
|
rewrite(host_model, schedule_model, RHS, mapping)
|