Procházet zdrojové kódy

Added a GlobalConstraint class

Yentl Van Tendeloo před 8 roky
rodič
revize
360cac5fe5
3 změnil soubory, kde provedl 17 přidání a 7 odebrání
  1. binární
      bootstrap/bootstrap.m.gz
  2. 14 7
      bootstrap/conformance_scd.alc
  3. 3 0
      bootstrap/metamodels.alc

binární
bootstrap/bootstrap.m.gz


+ 14 - 7
bootstrap/conformance_scd.alc

@@ -263,13 +263,20 @@ String function conformance_scd(model : Element):
 			if (result != "OK"):
 				return ((("Complex attribute doesn't match for: " + complex_instance) + "\n Message: ") + result)!
 
-	// Structure seems fine, now do static semantics
-	if (dict_in(metamodel, "constraints")):
-		Element constraint_function
-		constraint_function = metamodel["constraints"]
-		return constraint_function(model)!
-	else:
-		return "OK"!
+	// Structure seems fine, now do global constraints
+	Element global_constraints
+	String constraint
+	Element func
+
+	global_constraints = allInstances(model, "GlobalConstraints")
+	while (read_nr_out(global_constraints) > 0):
+		constraint = set_pop(global_constraints)
+		func = get_func_AL_model(import_node(read_attribute(model, constraint, "global_constraint")))
+		result = func(model)
+		if (result != "OK"):
+			return result!
+
+	return "OK"!
 
 String function check_location_conformance(instance_location : String, type_location : String):
 	// Check whether the instance is typed by the type

+ 3 - 0
bootstrap/metamodels.alc

@@ -136,6 +136,9 @@ Element function initialize_SCD(location : String):
 	instantiate_attribute_code(scd, "Location", "constraint", constraint_Location)
 	instantiate_attribute_code(scd, "ActionLanguage", "constraint", constraint_ActionLanguage)
 
+	instantiate_node(scd, "Class", "GlobalConstraint")
+	model_define_attribute(scd, "GlobalConstraint", "global_constraint", False, "ActionLanguage")
+
 	return scd!
 
 Element function initialize_PN(location_SCD : String, location_PN : String):