diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/concrete_activity/expected/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/concrete_activity/expected/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/concrete_activity/expected/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/concrete_activity/expected/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/concrete_activity/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/concrete_activity/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/concrete_activity/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/concrete_activity/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/conditional_expressions/expected/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/conditional_expressions/expected/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/conditional_expressions/expected/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/conditional_expressions/expected/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/conditional_expressions/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/conditional_expressions/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/conditional_expressions/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/conditional_expressions/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/conflict_rename_deep/expected/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/conflict_rename_deep/expected/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/conflict_rename_deep/expected/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/conflict_rename_deep/expected/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/conflict_rename_deep/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/conflict_rename_deep/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/conflict_rename_deep/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/conflict_rename_deep/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/conflicting_name_taken/expected/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/conflicting_name_taken/expected/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/conflicting_name_taken/expected/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/conflicting_name_taken/expected/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/conflicting_name_taken/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/conflicting_name_taken/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/conflicting_name_taken/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/conflicting_name_taken/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/constraints_and_invariants/expected/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/constraints_and_invariants/expected/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/constraints_and_invariants/expected/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/constraints_and_invariants/expected/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/constraints_and_invariants/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/constraints_and_invariants/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/constraints_and_invariants/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/constraints_and_invariants/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/control_flow_guards/expected/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/control_flow_guards/expected/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/control_flow_guards/expected/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/control_flow_guards/expected/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/control_flow_guards/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/control_flow_guards/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/control_flow_guards/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/control_flow_guards/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/guards_and_effects/expected/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/guards_and_effects/expected/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/guards_and_effects/expected/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/guards_and_effects/expected/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/guards_and_effects/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/guards_and_effects/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/guards_and_effects/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/guards_and_effects/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/shadow_call/expected/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/shadow_call/expected/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/shadow_call/expected/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/shadow_call/expected/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/shadow_call/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/shadow_call/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/shadow_call/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/shadow_call/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/simple_composite/expected/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/simple_composite/expected/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/simple_composite/expected/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/simple_composite/expected/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/simple_composite/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/simple_composite/input.uml
similarity index 100%
rename from plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests/simple_composite/input.uml
rename to plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-compositedatatypeflattener/simple_composite/input.uml
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/doc/DoubleNested Activity Diagram.jpg b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/doc/DoubleNested Activity Diagram.jpg
new file mode 100644
index 000000000..c5ed294b9
Binary files /dev/null and b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/doc/DoubleNested Activity Diagram.jpg differ
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/doc/Entrypoint Activity Diagram.jpg b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/doc/Entrypoint Activity Diagram.jpg
new file mode 100644
index 000000000..f10b60e4d
Binary files /dev/null and b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/doc/Entrypoint Activity Diagram.jpg differ
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/doc/Nested Activity Diagram.jpg b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/doc/Nested Activity Diagram.jpg
new file mode 100644
index 000000000..9f6a84148
Binary files /dev/null and b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/doc/Nested Activity Diagram.jpg differ
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/expected/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/expected/input.uml
new file mode 100644
index 000000000..0f6760857
--- /dev/null
+++ b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/expected/input.uml
@@ -0,0 +1,180 @@
+
+
+
+
+
+ Original-ID-Path:_yZoBEL8fEfCf1ui-oImEfg
+
+
+
+ Original-ID-Path:_eFf1AL8pEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_eFgcEL8pEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_eFgcEb8pEfCf1ui-oImEfg
+
+
+
+
+
+ Original-ID-Path:_2grWAL8fEfCf1ui-oImEfg
+
+
+
+ Original-ID-Path:_8YdMQL8gEfCf1ui-oImEfg
+
+
+ Original-Structure:4 Start
+
+
+
+
+ Original-ID-Path:_9zDiAL8gEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_TqmsoMPNEfCeqermeHofWg
+
+
+
+
+ Original-ID-Path:_UKyokMPNEfCeqermeHofWg
+
+
+
+
+ Original-ID-Path:_Uyx1oMPNEfCeqermeHofWg
+
+
+
+
+ Original-ID-Path:_VYiOEMPNEfCeqermeHofWg
+
+
+ Original-Structure:4 End
+
+
+
+
+ Original-ID-Path:_KzK-0L8gEfCf1ui-oImEfg _3OQNsL8fEfCf1ui-oImEfg _qPc_gL8gEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_KzK-0L8gEfCf1ui-oImEfg _3OQNsL8fEfCf1ui-oImEfg _H7oUgL8hEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_KzK-0L8gEfCf1ui-oImEfg _3OQNsL8fEfCf1ui-oImEfg _HKaS8L8hEfCf1ui-oImEfg _xNjPgL8fEfCf1ui-oImEfg _zc6NkL8gEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_KzK-0L8gEfCf1ui-oImEfg _3OQNsL8fEfCf1ui-oImEfg _HKaS8L8hEfCf1ui-oImEfg _xNjPgL8fEfCf1ui-oImEfg _kZs-AL8pEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_RclV4MPNEfCeqermeHofWg _xNjPgL8fEfCf1ui-oImEfg _zc6NkL8gEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_RclV4MPNEfCeqermeHofWg _xNjPgL8fEfCf1ui-oImEfg _kZs-AL8pEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_HXCPIL8gEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_Ik_QAL8gEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_IrCAsMPNEfCeqermeHofWg
+
+
+
+
+ Original-ID-Path:_JpVcAMPNEfCeqermeHofWg
+
+
+
+ Original-ID-Path:_JpVcAcPNEfCeqermeHofWg
+
+
+
+
+
+
+
+
+
+ Original-ID-Path:_KzK-0L8gEfCf1ui-oImEfg _3OQNsL8fEfCf1ui-oImEfg _HKaS8L8hEfCf1ui-oImEfg _xNjPgL8fEfCf1ui-oImEfg _XxOakL8pEfCf1ui-oImEfg
+
+ // TODO body of OpaqueAction1
+
+
+
+
+
+ Original-ID-Path:_RclV4MPNEfCeqermeHofWg _xNjPgL8fEfCf1ui-oImEfg _XxOakL8pEfCf1ui-oImEfg
+
+ // TODO body of OpaqueAction1
+
+
+
+
+
+ Original-ID-Path:_Rjk7oL8gEfCf1ui-oImEfg
+
+
+
+ Original-ID-Path:_b6j9kL8gEfCf1ui-oImEfg
+
+
+
+ Original-ID-Path:_b6j9kb8gEfCf1ui-oImEfg
+
+
+
+
+
+ Original-ID-Path:_b-_xoL8gEfCf1ui-oImEfg
+
+
+
+ Original-ID-Path:_b-_xob8gEfCf1ui-oImEfg
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ decisionResult := true
+
+
+ decisionResult := false
+
+
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/input.uml
new file mode 100644
index 000000000..36545d29b
--- /dev/null
+++ b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_fork/input.uml
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // TODO body of OpaqueAction1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ decisionResult := decision
+
+
+
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/doc/DoubleNested Activity Diagram.jpg b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/doc/DoubleNested Activity Diagram.jpg
new file mode 100644
index 000000000..c5ed294b9
Binary files /dev/null and b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/doc/DoubleNested Activity Diagram.jpg differ
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/doc/Entrypoint Activity Diagram.jpg b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/doc/Entrypoint Activity Diagram.jpg
new file mode 100644
index 000000000..171b83b80
Binary files /dev/null and b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/doc/Entrypoint Activity Diagram.jpg differ
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/doc/Nested Activity Diagram.jpg b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/doc/Nested Activity Diagram.jpg
new file mode 100644
index 000000000..9f6a84148
Binary files /dev/null and b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/doc/Nested Activity Diagram.jpg differ
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/doc/Orphan Activity Diagram.jpg b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/doc/Orphan Activity Diagram.jpg
new file mode 100644
index 000000000..eea2ff26a
Binary files /dev/null and b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/doc/Orphan Activity Diagram.jpg differ
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/expected/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/expected/input.uml
new file mode 100644
index 000000000..f32077ea6
--- /dev/null
+++ b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/expected/input.uml
@@ -0,0 +1,124 @@
+
+
+
+
+
+ Original-ID-Path:_yZoBEL8fEfCf1ui-oImEfg
+
+
+
+ Original-ID-Path:_eFf1AL8pEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_eFgcEL8pEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_eFgcEb8pEfCf1ui-oImEfg
+
+
+
+
+
+ Original-ID-Path:_2grWAL8fEfCf1ui-oImEfg
+
+
+
+ Original-ID-Path:_8YdMQL8gEfCf1ui-oImEfg
+
+
+ Original-Structure:3 Start
+
+
+
+
+ Original-ID-Path:_9zDiAL8gEfCf1ui-oImEfg
+
+
+ Original-Structure:3 End
+
+
+
+
+ Original-ID-Path:_KzK-0L8gEfCf1ui-oImEfg _3OQNsL8fEfCf1ui-oImEfg _qPc_gL8gEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_KzK-0L8gEfCf1ui-oImEfg _3OQNsL8fEfCf1ui-oImEfg _H7oUgL8hEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_KzK-0L8gEfCf1ui-oImEfg _3OQNsL8fEfCf1ui-oImEfg _HKaS8L8hEfCf1ui-oImEfg _xNjPgL8fEfCf1ui-oImEfg _zc6NkL8gEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_KzK-0L8gEfCf1ui-oImEfg _3OQNsL8fEfCf1ui-oImEfg _HKaS8L8hEfCf1ui-oImEfg _xNjPgL8fEfCf1ui-oImEfg _kZs-AL8pEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_HXCPIL8gEfCf1ui-oImEfg
+
+
+
+
+ Original-ID-Path:_Ik_QAL8gEfCf1ui-oImEfg
+
+
+
+
+
+
+
+
+ Original-ID-Path:_KzK-0L8gEfCf1ui-oImEfg _3OQNsL8fEfCf1ui-oImEfg _HKaS8L8hEfCf1ui-oImEfg _xNjPgL8fEfCf1ui-oImEfg _XxOakL8pEfCf1ui-oImEfg
+
+ // TODO body of OpaqueAction1
+
+
+
+
+
+ Original-ID-Path:_Rjk7oL8gEfCf1ui-oImEfg
+
+
+
+ Original-ID-Path:_b6j9kL8gEfCf1ui-oImEfg
+
+
+
+ Original-ID-Path:_b6j9kb8gEfCf1ui-oImEfg
+
+
+
+
+
+ Original-ID-Path:_b-_xoL8gEfCf1ui-oImEfg
+
+
+
+ Original-ID-Path:_b-_xob8gEfCf1ui-oImEfg
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ decisionResult := true
+
+
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/input.uml b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/input.uml
new file mode 100644
index 000000000..130e8de74
--- /dev/null
+++ b/plugins/com.github.tno.pokayoke.transform.flatten/resources-test/regressiontests-templateparameterflattener/template_parameters_with_orphan/input.uml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // TODO body of OpaqueAction1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ decisionResult := decision
+
+
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/src-test/com/github/tno/pokayoke/transform/flatten/CompositeDataTypeFlattenerRegressionTest.java b/plugins/com.github.tno.pokayoke.transform.flatten/src-test/com/github/tno/pokayoke/transform/flatten/CompositeDataTypeFlattenerRegressionTest.java
index afcfab754..d6f3c5e7a 100644
--- a/plugins/com.github.tno.pokayoke.transform.flatten/src-test/com/github/tno/pokayoke/transform/flatten/CompositeDataTypeFlattenerRegressionTest.java
+++ b/plugins/com.github.tno.pokayoke.transform.flatten/src-test/com/github/tno/pokayoke/transform/flatten/CompositeDataTypeFlattenerRegressionTest.java
@@ -16,7 +16,7 @@
class CompositeDataTypeFlattenerRegressionTest extends RegressionTest {
public static final String INPUT_FILE_EXTENSION = "uml";
- public static final String REGRESSIONTESTS_NAME = "regressiontests";
+ public static final String REGRESSIONTESTS_NAME = "regressiontests-compositedatatypeflattener";
public static Stream extends Arguments> provideArguments() throws Exception {
return RegressionTest.provideArguments(INPUT_FILE_EXTENSION, REGRESSIONTESTS_NAME);
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/src-test/com/github/tno/pokayoke/transform/flatten/TemplateParameterFlattenerRegressionTest.java b/plugins/com.github.tno.pokayoke.transform.flatten/src-test/com/github/tno/pokayoke/transform/flatten/TemplateParameterFlattenerRegressionTest.java
new file mode 100644
index 000000000..7d4d9899d
--- /dev/null
+++ b/plugins/com.github.tno.pokayoke.transform.flatten/src-test/com/github/tno/pokayoke/transform/flatten/TemplateParameterFlattenerRegressionTest.java
@@ -0,0 +1,36 @@
+
+package com.github.tno.pokayoke.transform.flatten;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.stream.Stream;
+
+import org.eclipse.core.runtime.CoreException;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import com.github.tno.pokayoke.transform.tests.common.RegressionTest;
+
+/** Regression tests for the template parameter flattener. */
+class TemplateParameterFlattenerRegressionTest extends RegressionTest {
+ public static final String INPUT_FILE_EXTENSION = "uml";
+
+ public static final String REGRESSIONTESTS_NAME = "regressiontests-templateparameterflattener";
+
+ public static Stream extends Arguments> provideArguments() throws Exception {
+ return RegressionTest.provideArguments(INPUT_FILE_EXTENSION, REGRESSIONTESTS_NAME);
+ }
+
+ @Override
+ @ParameterizedTest
+ @MethodSource("provideArguments")
+ public void regressionTest(Path inputPath, Path expectedPath, Path outputPath, String message) throws Exception {
+ super.regressionTest(inputPath, expectedPath, outputPath, message);
+ }
+
+ @Override
+ protected void actTest(Path inputPath, Path outputPath) throws IOException, CoreException {
+ FlattenUMLActivity.transformFile(inputPath, outputPath);
+ }
+}
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/src/com/github/tno/pokayoke/transform/flatten/FlattenUMLActivity.java b/plugins/com.github.tno.pokayoke.transform.flatten/src/com/github/tno/pokayoke/transform/flatten/FlattenUMLActivity.java
index 4cf3d5151..ebb8878b6 100644
--- a/plugins/com.github.tno.pokayoke.transform.flatten/src/com/github/tno/pokayoke/transform/flatten/FlattenUMLActivity.java
+++ b/plugins/com.github.tno.pokayoke.transform.flatten/src/com/github/tno/pokayoke/transform/flatten/FlattenUMLActivity.java
@@ -2,10 +2,12 @@
package com.github.tno.pokayoke.transform.flatten;
import java.io.IOException;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
+import org.apache.commons.io.FilenameUtils;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
@@ -27,6 +29,8 @@
import com.github.tno.pokayoke.transform.common.NameHelper;
import com.github.tno.pokayoke.transform.common.StructureInfoHelper;
import com.github.tno.pokayoke.transform.common.ValidationHelper;
+import com.github.tno.synthml.uml.profile.cif.CifScopedContext;
+import com.github.tno.synthml.uml.profile.util.PokaYokeUmlProfileUtil;
import com.github.tno.synthml.uml.profile.util.UMLActivityUtils;
/** Flattens nested UML activities. */
@@ -40,10 +44,12 @@ public FlattenUMLActivity(Model model) {
this.structureInfoHelper = new StructureInfoHelper();
}
- public static void transformFile(String sourcePath, String targetPath) throws IOException, CoreException {
- Model model = FileHelper.loadModel(sourcePath);
+ public static void transformFile(Path sourcePath, Path targetPath) throws IOException, CoreException {
+ String filePrefix = FilenameUtils.removeExtension(sourcePath.getFileName().toString());
+ Path umlOutputFilePath = targetPath.resolve(filePrefix + ".uml");
+ Model model = FileHelper.loadModel(sourcePath.toString());
new FlattenUMLActivity(model).transform();
- FileHelper.storeModel(model, targetPath);
+ FileHelper.storeModel(model, umlOutputFilePath.toString());
}
public void transform() throws CoreException {
@@ -63,6 +69,9 @@ public void transform() throws CoreException {
// Transform all elements within the model.
transform(model);
+ // Destroy all parameterized activities.
+ destroyParameterizedActivities(model);
+
// Add structure comments to the outgoing edges of the initial nodes and the incoming edges of the final nodes
// in all outermost activities.
structureInfoHelper.addStructureInfoInActivities(model);
@@ -72,9 +81,21 @@ private void transform(Element element) {
if (element instanceof Activity activityElement) {
transformActivity(activityElement, null);
} else if (element instanceof Class classElement) {
- classElement.getOwnedMembers().forEach(this::transform);
+ classElement.getOwnedMembers().stream().toList().forEach(this::transform);
+ } else if (element instanceof Model modelElement) {
+ modelElement.getOwnedMembers().stream().toList().forEach(this::transform);
+ }
+ }
+
+ private void destroyParameterizedActivities(Element element) {
+ if (element instanceof Activity activityElement
+ && !CifScopedContext.getClassifierTemplateParameters(activityElement).isEmpty())
+ {
+ element.destroy();
+ } else if (element instanceof Class classElement) {
+ classElement.getOwnedMembers().stream().toList().forEach(this::destroyParameterizedActivities);
} else if (element instanceof Model modelElement) {
- modelElement.getOwnedMembers().forEach(this::transform);
+ modelElement.getOwnedMembers().stream().toList().forEach(this::destroyParameterizedActivities);
}
}
@@ -95,7 +116,11 @@ private void transformActivity(Activity childBehavior, CallBehaviorAction callBe
// Translate only non-shadowed call behavior actions. Shadowed (stereotyped) call behavior actions are
// considered leaves, as are call behavior actions that call opaque behaviors.
- if (behavior instanceof Activity activity && action.getAppliedStereotypes().isEmpty()) {
+ if (behavior instanceof Activity activity && action.getAppliedStereotypes().stream()
+ .filter(s -> !PokaYokeUmlProfileUtil.FORMAL_CALL_BEHAVIOR_ACTION_STEREOTYPE
+ .equals(s.getQualifiedName()))
+ .findAny().isEmpty())
+ {
transformActivity(activity, action);
}
}
@@ -115,6 +140,12 @@ private void transformActivity(Activity childBehavior, CallBehaviorAction callBe
Activity childBehaviorCopy = copyWithProfiles(childBehavior);
+ // Updating guards and effects in the copied activity requires the copy to be assigned a package.
+ childBehaviorCopy.setPackage(childBehavior.getNearestPackage());
+
+ // Flatten the template parameters.
+ TemplateParameterFlattener.unfoldActivity(childBehaviorCopy, callBehaviorActionToReplace);
+
// Construct the prefix name.
String prefixName = callBehaviorActionToReplace.getName() + "__" + childBehaviorCopy.getName();
diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/src/com/github/tno/pokayoke/transform/flatten/TemplateParameterFlattener.java b/plugins/com.github.tno.pokayoke.transform.flatten/src/com/github/tno/pokayoke/transform/flatten/TemplateParameterFlattener.java
new file mode 100644
index 000000000..05711bc0b
--- /dev/null
+++ b/plugins/com.github.tno.pokayoke.transform.flatten/src/com/github/tno/pokayoke/transform/flatten/TemplateParameterFlattener.java
@@ -0,0 +1,236 @@
+
+package com.github.tno.pokayoke.transform.flatten;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.eclipse.escet.cif.parser.ast.automata.AAssignmentUpdate;
+import org.eclipse.escet.cif.parser.ast.automata.AElifUpdate;
+import org.eclipse.escet.cif.parser.ast.automata.AIfUpdate;
+import org.eclipse.escet.cif.parser.ast.automata.AUpdate;
+import org.eclipse.escet.cif.parser.ast.expressions.ABinaryExpression;
+import org.eclipse.escet.cif.parser.ast.expressions.ABoolExpression;
+import org.eclipse.escet.cif.parser.ast.expressions.AElifExpression;
+import org.eclipse.escet.cif.parser.ast.expressions.AExpression;
+import org.eclipse.escet.cif.parser.ast.expressions.AIfExpression;
+import org.eclipse.escet.cif.parser.ast.expressions.AIntExpression;
+import org.eclipse.escet.cif.parser.ast.expressions.ANameExpression;
+import org.eclipse.escet.cif.parser.ast.expressions.AUnaryExpression;
+import org.eclipse.uml2.uml.Activity;
+import org.eclipse.uml2.uml.ActivityNode;
+import org.eclipse.uml2.uml.CallBehaviorAction;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.ControlFlow;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.OpaqueAction;
+import org.eclipse.uml2.uml.RedefinableElement;
+import org.eclipse.uml2.uml.TemplateSignature;
+
+import com.github.tno.synthml.uml.profile.cif.ACifObjectToString;
+import com.github.tno.synthml.uml.profile.cif.CifParserHelper;
+import com.github.tno.synthml.uml.profile.util.PokaYokeUmlProfileUtil;
+import com.google.common.base.Verify;
+
+/** Template parameter flattener. */
+public class TemplateParameterFlattener {
+ private TemplateParameterFlattener() {
+ }
+
+ /**
+ * Unfolds guards and effects of a redefinable element.
+ *
+ * @param element The redefinable element.
+ * @param nameToArgument The mapping of template parameter names to concrete arguments.
+ */
+ private static void unfoldRedefinableElement(RedefinableElement element, Map nameToArgument) {
+ // Perform the guard unfolding. Skip if there is no guard.
+ AExpression guardExpr = CifParserHelper.parseGuard(element);
+ if (guardExpr != null) {
+ AExpression newGuard = unfoldAExpression(guardExpr, nameToArgument);
+ String newGuardString = ACifObjectToString.toString(newGuard);
+ PokaYokeUmlProfileUtil.setGuard(element, newGuardString);
+ }
+
+ // Perform the unfolding of the effects.
+ List effects = PokaYokeUmlProfileUtil.getEffects(element);
+ List newEffects = new ArrayList<>();
+ for (String effect: effects) {
+ List updates = CifParserHelper.parseUpdates(effect, element);
+ String newEffect = updates.stream().flatMap(update -> unfoldAUpdate(update, nameToArgument).stream())
+ .map(newUpdate -> ACifObjectToString.toString(newUpdate)).collect(Collectors.joining(", "));
+ newEffects.add(newEffect);
+ }
+ PokaYokeUmlProfileUtil.setEffects(element, newEffects);
+ }
+
+ /**
+ * Unfolds a CIF {@link AExpression}: replaces template parameters with the given arguments.
+ *
+ * @param expression A CIF {@link AExpression} to be unfolded.
+ * @param nameToArgument The mapping of template parameter names to concrete arguments.
+ * @return The unfolded CIF {@link AExpression}.
+ */
+ private static AExpression unfoldAExpression(AExpression expression, Map nameToArgument) {
+ if (expression instanceof ABinaryExpression binExpr) {
+ AExpression unfoldedLhsExpression = unfoldAExpression(binExpr.left, nameToArgument);
+ AExpression unfoldedRhsExpression = unfoldAExpression(binExpr.right, nameToArgument);
+
+ // Combine the unfolded left and right components to form a new binary expression.
+ return new ABinaryExpression(binExpr.operator, unfoldedLhsExpression, unfoldedRhsExpression,
+ expression.position);
+ } else if (expression instanceof AUnaryExpression unaryExpr) {
+ return new AUnaryExpression(unaryExpr.operator, unfoldAExpression(unaryExpr.child, nameToArgument),
+ unaryExpr.position);
+ } else if (expression instanceof ANameExpression nameExpr) {
+ return nameToArgument.getOrDefault(nameExpr.name.name, nameExpr);
+ } else if (expression instanceof ABoolExpression || expression instanceof AIntExpression) {
+ // Expressions without children don't need unfolding.
+ return expression;
+ } else if (expression instanceof AIfExpression ifExpr) {
+ List guardExprs = ifExpr.guards.stream().map(guard -> unfoldAExpression(guard, nameToArgument))
+ .toList();
+ AExpression thenExpr = unfoldAExpression(ifExpr.then, nameToArgument);
+ List elifExprs = ifExpr.elifs.stream()
+ .map(elif -> unfoldAElifExpression(elif, nameToArgument)).toList();
+ AExpression elseExpr = unfoldAExpression(ifExpr.elseExpr, nameToArgument);
+ return new AIfExpression(guardExprs, thenExpr, elifExprs, elseExpr, ifExpr.position);
+ } else {
+ throw new RuntimeException(String.format("Unfolding expressions of class '%s' is not supported.",
+ expression.getClass().getSimpleName()));
+ }
+ }
+
+ private static AElifExpression unfoldAElifExpression(AElifExpression elifExpr,
+ Map nameToArgument)
+ {
+ List guardExprs = elifExpr.guards.stream().map(guard -> unfoldAExpression(guard, nameToArgument))
+ .toList();
+ AExpression thenExpr = unfoldAExpression(elifExpr.then, nameToArgument);
+ return new AElifExpression(guardExprs, thenExpr, elifExpr.position);
+ }
+
+ /**
+ * Unfolds a CIF {@link AUpdate}: Replaces template parameters with the given arguments.
+ *
+ * @param update A CIF {@link AUpdate} to be unfolded.
+ * @param nameToArgument The mapping of template parameter names to concrete arguments.
+ * @return The list containing the unfolded CIF {@link AUpdate}.
+ */
+ private static List unfoldAUpdate(AUpdate update, Map nameToArgument) {
+ if (update instanceof AAssignmentUpdate assign) {
+ return unfoldAAssignmentUpdate(assign, nameToArgument);
+ } else if (update instanceof AIfUpdate ifUpdate) {
+ AUpdate newIfUpdate = unfoldAIfUpdate(ifUpdate, nameToArgument);
+ return List.of(newIfUpdate);
+ } else {
+ throw new RuntimeException(
+ String.format("Unfolding updates of class '%s' not supported.", update.getClass().getSimpleName()));
+ }
+ }
+
+ /**
+ * Unfolds a CIF {@link AAssignmentUpdate}: Replaces template parameters with the given arguments.
+ *
+ * @param assignUpdate A CIF {@link AAssignmentUpdate} to be unfolded.
+ * @param nameToArgument The mapping of template parameter names to concrete arguments.
+ * @return The unfolded CIF {@link AAssignmentUpdate}.
+ */
+ private static List unfoldAAssignmentUpdate(AAssignmentUpdate assignUpdate,
+ Map nameToArgument)
+ {
+ // Sanity check: 'addressable' must be a name expression which must not be a parameter.
+ Verify.verify(assignUpdate.addressable instanceof ANameExpression addressable
+ && !nameToArgument.containsKey(addressable.name.name));
+
+ return List.of(new AAssignmentUpdate(assignUpdate.addressable,
+ unfoldAExpression(assignUpdate.value, nameToArgument), assignUpdate.position));
+ }
+
+ /**
+ * Unfolds a CIF {@link AIfUpdate}: Replaces template parameters with the given arguments.
+ *
+ * @param ifUpdate A CIF {@link AIfUpdate} to be unfolded.
+ * @param nameToArgument The mapping of template parameter names to concrete arguments.
+ * @return The unfolded CIF {@link AIfUpdate}.
+ */
+ private static AUpdate unfoldAIfUpdate(AIfUpdate ifUpdate, Map nameToArgument) {
+ // Process the 'if' statements.
+ List unfoldedGuards = ifUpdate.guards.stream().map(u -> unfoldAExpression(u, nameToArgument))
+ .toList();
+
+ // Process the 'then' statements.
+ List unfoldedThens = ifUpdate.thens.stream().flatMap(u -> unfoldAUpdate(u, nameToArgument).stream())
+ .toList();
+
+ // Process the 'elif' statements.
+ List unfoldedElifs = ifUpdate.elifs.stream().map(u -> unfoldAElifUpdate(u, nameToArgument))
+ .toList();
+
+ // Process the 'else' statements.
+ List unfoldedElses = ifUpdate.elses.stream().flatMap(u -> unfoldAUpdate(u, nameToArgument).stream())
+ .toList();
+
+ return new AIfUpdate(unfoldedGuards, unfoldedThens, unfoldedElifs, unfoldedElses, ifUpdate.position);
+ }
+
+ private static AElifUpdate unfoldAElifUpdate(AElifUpdate elifUpdate, Map nameToArgument) {
+ // Process the 'guards'.
+ List unfoldedElifGuards = elifUpdate.guards.stream().map(u -> unfoldAExpression(u, nameToArgument))
+ .toList();
+
+ // Process the 'thens'.
+ List unfoldedElifThens = elifUpdate.thens.stream()
+ .flatMap(u -> unfoldAUpdate(u, nameToArgument).stream()).toList();
+
+ return new AElifUpdate(unfoldedElifGuards, unfoldedElifThens, elifUpdate.position);
+ }
+
+ public static void unfoldActivity(Activity activity, CallBehaviorAction callBehaviorActionToReplace) {
+ List activityArguments = CifParserHelper.parseArguments(callBehaviorActionToReplace);
+ Map nameToArgument = activityArguments.stream().collect(
+ Collectors.toMap(update -> ((ANameExpression)update.addressable).name.name, update -> update.value));
+
+ // Unfold the guards and effects of owned elements.
+ for (Element ownedElement: activity.getOwnedElements()) {
+ if (ownedElement instanceof ControlFlow controlEdge) {
+ // Get the incoming and outgoing guards, unfold them, and substitute the corresponding string.
+ AExpression incomingGuard = CifParserHelper.parseIncomingGuard(controlEdge);
+ if (incomingGuard != null) {
+ AExpression unfoldedIncoming = unfoldAExpression(incomingGuard, nameToArgument);
+ PokaYokeUmlProfileUtil.setIncomingGuard(controlEdge, ACifObjectToString.toString(unfoldedIncoming));
+ }
+
+ AExpression outgoingGuard = CifParserHelper.parseOutgoingGuard(controlEdge);
+ if (outgoingGuard != null) {
+ AExpression unfoldedOutgoing = unfoldAExpression(outgoingGuard, nameToArgument);
+ PokaYokeUmlProfileUtil.setOutgoingGuard(controlEdge, ACifObjectToString.toString(unfoldedOutgoing));
+ }
+ } else if (ownedElement instanceof CallBehaviorAction callBehavior) {
+ if (PokaYokeUmlProfileUtil.isFormalElement(callBehavior)) {
+ // Shadowed call, process guards and effects of the call behavior.
+ unfoldRedefinableElement(callBehavior, nameToArgument);
+ }
+ } else if (ownedElement instanceof OpaqueAction internalAction) {
+ unfoldRedefinableElement(internalAction, nameToArgument);
+ } else if (ownedElement instanceof Constraint) {
+ // Constraints cannot be parameterized.
+ continue;
+ } else if (ownedElement instanceof ActivityNode) {
+ // Nodes in activities should not refer to properties.
+ continue;
+ } else if (ownedElement instanceof TemplateSignature) {
+ // Template signatures of parameterized activities should not refer to properties.
+ continue;
+ } else if (ownedElement instanceof Comment) {
+ // Comments are ignored by this translator.
+ continue;
+ } else {
+ throw new RuntimeException(String.format("Unfolding elements of class '%s' not supported",
+ ownedElement.getClass().getSimpleName()));
+ }
+ }
+ }
+}
diff --git a/plugins/com.github.tno.pokayoke.transform.uml2cameo/src/com/github/tno/pokayoke/transform/uml2cameo/UMLToCameoTransformer.java b/plugins/com.github.tno.pokayoke.transform.uml2cameo/src/com/github/tno/pokayoke/transform/uml2cameo/UMLToCameoTransformer.java
index 99ac1add7..09d0aaf62 100644
--- a/plugins/com.github.tno.pokayoke.transform.uml2cameo/src/com/github/tno/pokayoke/transform/uml2cameo/UMLToCameoTransformer.java
+++ b/plugins/com.github.tno.pokayoke.transform.uml2cameo/src/com/github/tno/pokayoke/transform/uml2cameo/UMLToCameoTransformer.java
@@ -504,12 +504,12 @@ private void transformCallBehaviorActionArguments(CallBehaviorAction callAction)
List arguments = new ArrayList<>();
List translatedAssignments = new ArrayList<>();
for (NamedTemplateParameter parameter: parameters) {
- String adressable = parameter.getName();
- AAssignmentUpdate argument = argumentMap.get(adressable);
+ String addressable = parameter.getName();
+ AAssignmentUpdate argument = argumentMap.get(addressable);
String value = translator.translateExpression(argument.value, ctxManager.getScopedContext(callAction));
- translatedAssignments.add(ARGUMENT_PREFIX + adressable + "=" + value);
- arguments.add(adressable);
+ translatedAssignments.add(ARGUMENT_PREFIX + addressable + "=" + value);
+ arguments.add(addressable);
}
String pythonBody = CifToPythonTranslator.mergeAll(translatedAssignments, "\n").get();
diff --git a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/ModelToCifTranslator.java b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/ModelToCifTranslator.java
index 7a9b70a99..fca3f7b78 100644
--- a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/ModelToCifTranslator.java
+++ b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/ModelToCifTranslator.java
@@ -51,9 +51,6 @@ public abstract class ModelToCifTranslator {
/** The mapping from UML properties to corresponding translated CIF discrete variables. */
protected final BiMap variableMap = HashBiMap.create();
- /** The context for querying the input UML model. */
- protected final CifContext context;
-
/** The translator for UML annotations (guards, updates, invariants, etc.). */
protected final UmlAnnotationsToCif translator;
@@ -66,6 +63,9 @@ public abstract class ModelToCifTranslator {
*/
protected final SynthesisChainTracking synthesisTracker;
+ /** The context for querying the input UML model. */
+ protected CifContext context;
+
/**
* Constructs a new {@link ModelToCifTranslator}.
*
diff --git a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java
index b136ae4d1..a0b510e22 100644
--- a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java
+++ b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java
@@ -73,6 +73,7 @@
import com.github.tno.pokayoke.transform.track.SynthesisChainTracking;
import com.github.tno.pokayoke.transform.track.UmlToCifTranslationPurpose;
import com.github.tno.synthml.uml.profile.cif.CifContext;
+import com.github.tno.synthml.uml.profile.cif.CifContextManager;
import com.github.tno.synthml.uml.profile.cif.CifParserHelper;
import com.github.tno.synthml.uml.profile.util.PokaYokeUmlProfileUtil;
import com.google.common.base.Preconditions;
@@ -248,15 +249,12 @@ public Specification translate() throws CoreException {
ValidationHelper.validateModel(activity.getModel());
}
- if (context.hasParameterizedActivities()) {
- throw new RuntimeException("Translating parameterized activities to CIF is unsupported.");
- }
-
// Flatten UML activities and normalize IDs.
if (translationPurpose == UmlToCifTranslationPurpose.SYNTHESIS) {
FlattenUMLActivity flattener = new FlattenUMLActivity(activity.getModel());
flattener.transform();
FileHelper.normalizeIds(activity.getModel());
+ context = new CifContextManager(activity.getModel()).getGlobalContext();
}
// Create the CIF specification to which the input UML model will be translated.
diff --git a/plugins/com.github.tno.pokayoke.transform.uml2gal/src/com/github/tno/pokayoke/transform/uml2gal/CifToGalExpressionTranslator.java b/plugins/com.github.tno.pokayoke.transform.uml2gal/src/com/github/tno/pokayoke/transform/uml2gal/CifToGalExpressionTranslator.java
index 853eacb16..b3fe0119f 100644
--- a/plugins/com.github.tno.pokayoke.transform.uml2gal/src/com/github/tno/pokayoke/transform/uml2gal/CifToGalExpressionTranslator.java
+++ b/plugins/com.github.tno.pokayoke.transform.uml2gal/src/com/github/tno/pokayoke/transform/uml2gal/CifToGalExpressionTranslator.java
@@ -78,7 +78,7 @@ protected Object visit(Object addressable, TextPosition assignmentPos, Object va
assignment.setType(AssignType.ASSIGN);
return assignment;
} else {
- throw new IllegalArgumentException("Unexpected adressable type:" + addressable);
+ throw new IllegalArgumentException("Unexpected addressable type:" + addressable);
}
}