|
@@ -21,6 +21,7 @@ Element function make_matching_schedule(schedule_model : Element, LHS : String,
|
|
|
schedule = create_node()
|
|
|
workset = create_node()
|
|
|
all_elements = allAssociationDestinations(schedule_model, LHS, "LHS_contains")
|
|
|
+ log("All elements: " + set_to_string(all_elements))
|
|
|
full_all_elements = set_copy(all_elements)
|
|
|
required_size = read_nr_out(all_elements)
|
|
|
|
|
@@ -45,6 +46,7 @@ Element function make_matching_schedule(schedule_model : Element, LHS : String,
|
|
|
if (set_in(full_all_elements, next)):
|
|
|
if (bool_not(set_in(ignore, read_attribute(schedule_model, next, "label")))):
|
|
|
list_append(schedule, next)
|
|
|
+ else:
|
|
|
required_size = required_size - 1
|
|
|
|
|
|
// If it is an edge, we should also add the target and source
|
|
@@ -60,6 +62,13 @@ Element function make_matching_schedule(schedule_model : Element, LHS : String,
|
|
|
if (set_in_node(schedule_model["model"], read_out(schedule_model["model"][next], counter))):
|
|
|
set_add(workset, reverseKeyLookup(schedule_model["model"], read_out(schedule_model["model"][next], counter)))
|
|
|
|
|
|
+ // And incoming links
|
|
|
+ counter = read_nr_in(schedule_model["model"][next])
|
|
|
+ while (counter > 0):
|
|
|
+ counter = counter - 1
|
|
|
+ if (set_in_node(schedule_model["model"], read_in(schedule_model["model"][next], counter))):
|
|
|
+ set_add(workset, reverseKeyLookup(schedule_model["model"], read_in(schedule_model["model"][next], counter)))
|
|
|
+
|
|
|
return schedule!
|
|
|
|
|
|
Element function get_possible_bindings(host_model : Element, schedule_model : Element, current_element : String, map : Element):
|
|
@@ -69,6 +78,7 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
|
|
|
String typename
|
|
|
String original_typename
|
|
|
|
|
|
+
|
|
|
options = create_node()
|
|
|
|
|
|
typename = read_type(schedule_model, current_element)
|
|
@@ -250,8 +260,9 @@ Element function match(host_model : Element, schedule_model : Element, LHS : Str
|
|
|
|
|
|
mappings = create_node()
|
|
|
set_add(mappings, initial_mapping)
|
|
|
- while (bool_and(read_nr_out(schedule) > 0, read_nr_out(mappings) > 0)):
|
|
|
+ while (read_nr_out(schedule) > 0):
|
|
|
current_element = list_pop(schedule, 0)
|
|
|
+ log("Binding element with label " + cast_v2s(read_attribute(schedule_model, current_element, "label")))
|
|
|
new_mappings = create_node()
|
|
|
|
|
|
while (read_nr_out(mappings) > 0):
|
|
@@ -265,6 +276,11 @@ Element function match(host_model : Element, schedule_model : Element, LHS : Str
|
|
|
set_add(new_mappings, new_map)
|
|
|
|
|
|
mappings = new_mappings
|
|
|
+ log("Remaining options: " + cast_v2s(read_nr_out(mappings)))
|
|
|
+
|
|
|
+ if (read_nr_out(mappings) == 0):
|
|
|
+ // Stop because we have no more options remaining!
|
|
|
+ return create_node()!
|
|
|
|
|
|
// Finished, so try the global constraint
|
|
|
String constraint
|
|
@@ -439,6 +455,7 @@ Boolean function transform_composite(host_model : Element, schedule_model : Elem
|
|
|
|
|
|
current = set_pop(allAssociationDestinations(schedule_model, composite, "Initial"))
|
|
|
while (is_nominal_instance(schedule_model, current, "Rule")):
|
|
|
+ log("Executing " + current)
|
|
|
// Still a rule that we must execute
|
|
|
typename = read_type(schedule_model, current)
|
|
|
if (typename == "Atomic"):
|
|
@@ -491,6 +508,7 @@ Boolean function transform_forall(host_model : Element, schedule_model : Element
|
|
|
else:
|
|
|
result = False
|
|
|
|
|
|
+ log("Matches in forall: " + cast_v2s(read_nr_out(mappings)))
|
|
|
while (read_nr_out(mappings) > 0):
|
|
|
mapping = set_pop(mappings)
|
|
|
// TODO check if there are actually no deletions happening in the meantime of other matched elements...
|