Преглед изворни кода

Fixed bug in transformation: check if association source/destination is actually typed by required type

Yentl Van Tendeloo пре 8 година
родитељ
комит
eb7be888fe
2 измењених фајлова са 18 додато и 16 уклоњено
  1. 16 14
      bootstrap/transform.alc
  2. 2 2
      models/plant_to_EPN.mvc

+ 16 - 14
bootstrap/transform.alc

@@ -145,22 +145,24 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
 		if (bool_not(set_in(map, option))):
 			// Option is already present with another label, so skip this!
 
-			// Check for local constraints of element
-			if (element_eq(read_attribute(schedule_model, current_element, "constraint"), read_root())):
-				// No local constraints, so all is well
-				set_add(filtered_options, option)
-			else:
-				// Check local constraints and add only if positive
-				Element constraint_function
-				Boolean result
-				Element func
+			// Check if it conforms to the desired type
+			if (is_nominal_instance(host_model, option, original_typename)):
+				// Check for local constraints of element
+				if (element_eq(read_attribute(schedule_model, current_element, "constraint"), read_root())):
+					// No local constraints, so all is well
+					set_add(filtered_options, option)
+				else:
+					// Check local constraints and add only if positive
+					Element constraint_function
+					Boolean result
+					Element func
 
-				constraint_function = read_attribute(schedule_model, current_element, "constraint")
-				func = get_func_AL_model(import_node(constraint_function))
-				result = func(host_model, option)
+					constraint_function = read_attribute(schedule_model, current_element, "constraint")
+					func = get_func_AL_model(import_node(constraint_function))
+					result = func(host_model, option)
 
-				if (result):
-					set_add(filtered_options, option)
+					if (result):
+						set_add(filtered_options, option)
 
 	Element attributes
 	String attribute

+ 2 - 2
models/plant_to_EPN.mvc

@@ -703,10 +703,10 @@ A B {
                 }
             }
             RHS {
-                Post_PW_Plant/NormalState post_rd_0{
+                Post_PW_Plant/ErrorState post_rd_0{
                     label = "0"
                 }
-                Post_PW_Plant/ErrorState post_rd_1{
+                Post_PW_Plant/NormalState post_rd_1{
                     label = "1"
                 }
                 Post_PW_Plant/Transition post_rd_2 (post_rd_0, post_rd_1){