Browse Source

Added additional filtering step (untested)

Yentl Van Tendeloo 8 years ago
parent
commit
48cb210cff
2 changed files with 38 additions and 1 deletions
  1. BIN
      bootstrap/bootstrap.m.gz
  2. 38 1
      bootstrap/transform.alc

BIN
bootstrap/bootstrap.m.gz


+ 38 - 1
bootstrap/transform.alc

@@ -172,7 +172,44 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
 				if (result):
 				if (result):
 					set_add(filtered_options, option)
 					set_add(filtered_options, option)
 
 
-	return filtered_options!
+	Element attributes
+	String attribute
+	Element value
+	Element func
+	Boolean result
+	Element attributes_copy
+
+	options = filtered_options
+	filtered_options = create_node()
+	log("Checking options: " + set_to_string(options))
+
+	// Check whether all attributes have a satisfied condition
+	attributes_copy = dict_keys(getAttributeList(schedule_model, current_element))
+	log("Defined attributes: " + set_to_string(attributes_copy))
+
+	while (read_nr_out(options) > 0):
+		option = set_pop(options)
+		attributes = set_copy(attributes_copy)
+		log(" opt: " + option)
+
+		while (read_nr_out(attributes) > 0):
+			attribute = set_pop(attributes)
+			log("Check attribute: " + attribute)
+
+			value = read_attribute(schedule_model, current_element, attribute)
+			func = get_func_AL_model(value)
+			log("EXEC")
+			result = func(host_model, option, attribute)
+			log("Got result of constraint eval: " + cast_v2s(result))
+
+			if (result):
+				log("Adding")
+				set_add(filtered_options, option)
+			else:
+				log("Dropping")
+
+	options = filtered_options
+	return options!
 
 
 Element function full_match(host_model : Element, schedule_model : Element, current : String):
 Element function full_match(host_model : Element, schedule_model : Element, current : String):
 	Element NACs
 	Element NACs