|
@@ -541,7 +541,7 @@ Element function constraint(model : Element, name : String):
|
|
|
action_code = \
|
|
|
"""
|
|
|
include "primitives.alh"
|
|
|
-Integer function value(host_model : Element, RHS_model : Element):
|
|
|
+Integer function value(host_model : Element, mapping : Element):
|
|
|
\treturn 5!
|
|
|
"""
|
|
|
|
|
@@ -549,14 +549,14 @@ Integer function value(host_model : Element, RHS_model : Element):
|
|
|
"""
|
|
|
include "primitives.alh"
|
|
|
Boolean function constraint(host_model : Element, name : String):
|
|
|
-\treturn value_eq(host_model["model"][name], 1)!
|
|
|
+\treturn value_eq(host_model["model"][name], 2)!
|
|
|
"""
|
|
|
|
|
|
global_constraint_code = \
|
|
|
"""
|
|
|
include "primitives.alh"
|
|
|
Boolean function constraint(host_model : Element, mapping : Element):
|
|
|
-\treturn value_eq(host_model["model"][mapping["0_tokens"]], 1)!
|
|
|
+\treturn value_eq(host_model["model"][mapping["0_tokens"]], 2)!
|
|
|
"""
|
|
|
|
|
|
constructor_action = get_constructor(action_code)
|
|
@@ -627,3 +627,75 @@ Boolean function constraint(host_model : Element, mapping : Element):
|
|
|
],
|
|
|
None, "PO"))
|
|
|
|
|
|
+ def test_po_pn_interface_transform_UI(self):
|
|
|
+ constraint_code = \
|
|
|
+ """
|
|
|
+include "primitives.alh"
|
|
|
+include "modelling.alh"
|
|
|
+Boolean function constraint(host_model : Element, name : String):
|
|
|
+\treturn value_eq(read_attribute(host_model, name, "tokens"), 1)!
|
|
|
+ """
|
|
|
+
|
|
|
+ action_code = \
|
|
|
+ """
|
|
|
+include "primitives.alh"
|
|
|
+include "modelling.alh"
|
|
|
+Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
+\tunset_attribute(host_model, name, "tokens")
|
|
|
+\tinstantiate_attribute(host_model, name, "tokens", 5)
|
|
|
+\treturn!
|
|
|
+ """
|
|
|
+
|
|
|
+ constructor_action = get_constructor(action_code)
|
|
|
+ constructor_constraint = get_constructor(constraint_code)
|
|
|
+
|
|
|
+ self.assertTrue(run_file(all_files,
|
|
|
+ ["new", "PetriNets", "pn",
|
|
|
+ "instantiate", "Place", "p1",
|
|
|
+ "instantiate", "Place", "p2",
|
|
|
+ "instantiate", "Transition", "t1",
|
|
|
+ "instantiate", "P2T", "p2t", "p1", "t1",
|
|
|
+ "instantiate", "P2T", "p2t2", "p2", "t1",
|
|
|
+ "attr_add", "p1", "tokens", 1,
|
|
|
+ "attr_add", "p2", "tokens", 2,
|
|
|
+ "attr_add", "p2t", "weight", 1,
|
|
|
+ "attr_add", "p2t2", "weight", 2,
|
|
|
+ "exit",
|
|
|
+ "ramify", "PetriNets",
|
|
|
+ "new", "PetriNets_PRE", "pn_LHS",
|
|
|
+ "instantiate", "LHS", "lhs",
|
|
|
+ "instantiate", "Pre_Place", "p",
|
|
|
+ "instantiate", "Pre_Transition", "t",
|
|
|
+ "instantiate", "Pre_P2T", "pt", "p", "t",
|
|
|
+ "instantiate", "LHS_contains", "", "lhs", "p",
|
|
|
+ "instantiate", "LHS_contains", "", "lhs", "t",
|
|
|
+ "instantiate", "LHS_contains", "", "lhs", "pt",
|
|
|
+ "attr_add", "p", "label", "0_p",
|
|
|
+ "attr_add", "t", "label", "1_t",
|
|
|
+ "attr_add", "pt", "label", "2_pt",
|
|
|
+ "attr_add_code", "p", "constraint",
|
|
|
+ ] + constructor_constraint + [
|
|
|
+ "exit",
|
|
|
+ "new", "PetriNets_POST", "pn_RHS",
|
|
|
+ "instantiate", "RHS", "rhs",
|
|
|
+ "instantiate", "Post_Place", "p",
|
|
|
+ "instantiate", "Post_Transition", "t",
|
|
|
+ "instantiate", "RHS_contains", "", "rhs", "p",
|
|
|
+ "instantiate", "RHS_contains", "", "rhs", "t",
|
|
|
+ "attr_add", "p", "label", "0_p",
|
|
|
+ "attr_add", "t", "label", "1_t",
|
|
|
+ "attr_add_code", "p", "action",
|
|
|
+ ] + constructor_action + [
|
|
|
+ "exit",
|
|
|
+ "transform", "pn", "pn_LHS", "pn_RHS",
|
|
|
+ "load", "pn",
|
|
|
+ "list",
|
|
|
+ "verify",
|
|
|
+ "read",
|
|
|
+ "p1",
|
|
|
+ "read",
|
|
|
+ "p2",
|
|
|
+ "exit",
|
|
|
+ ],
|
|
|
+ None, "PO"))
|
|
|
+
|