diff options
author | Ed Willink | 2016-05-25 17:27:22 +0000 |
---|---|---|
committer | Ed Willink | 2016-05-25 18:06:11 +0000 |
commit | 958124224e324d56de6d4726570d42eaf7168ace (patch) | |
tree | 61c4c31d905d0a5f96b6f0cf4ce9aad86d684529 /examples | |
parent | 033d635767fa4be3a42dcf0f7561c9eb59e5d852 (diff) | |
download | org.eclipse.qvtd-958124224e324d56de6d4726570d42eaf7168ace.tar.gz org.eclipse.qvtd-958124224e324d56de6d4726570d42eaf7168ace.tar.xz org.eclipse.qvtd-958124224e324d56de6d4726570d42eaf7168ace.zip |
Diffstat (limited to 'examples')
19 files changed, 350 insertions, 13 deletions
diff --git a/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/.classpath b/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/.classpath index aa85680ac..f0c554985 100644 --- a/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/.classpath +++ b/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/.classpath @@ -1,15 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> - <attributes> - <attribute name="annotationpath" value="/org.eclipse.qvtd.pivot.qvtbase/annotations"/> - </attributes> - </classpathentry> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> - <attributes> - <attribute name="annotationpath" value="/org.eclipse.qvtd.pivot.qvtbase/annotations"/> - </attributes> - </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src-gen"/> <classpathentry kind="output" path="bin"/> diff --git a/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.classpath b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.classpath new file mode 100644 index 000000000..eca7bdba8 --- /dev/null +++ b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.gitignore b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.gitignore new file mode 100644 index 000000000..ae3c17260 --- /dev/null +++ b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.project b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.project new file mode 100644 index 000000000..090b39c33 --- /dev/null +++ b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.qvtd.examples.qvtrelation.hstm2fstm</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.settings/HierarchicalStateMachine2FlatStateMachine.qvtr.launch b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.settings/HierarchicalStateMachine2FlatStateMachine.qvtr.launch new file mode 100644 index 000000000..d7051b9d6 --- /dev/null +++ b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.settings/HierarchicalStateMachine2FlatStateMachine.qvtr.launch @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.qvtd.debug.launching.QVTrLaunchConfigurationDelegate">
+<booleanAttribute key="auto-build" value="false"/>
+<booleanAttribute key="console-trace" value="false"/>
+<stringAttribute key="direction" value="flat"/>
+<stringAttribute key="genmodel" value="platform:/resource/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine2FlatStateMachine.genmodel"/>
+<mapAttribute key="in">
+<mapEntry key="hier" value="platform:/resource/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/SimpleModel.xmi"/>
+</mapAttribute>
+<mapAttribute key="intermediates">
+<mapEntry key="QVTc" value="platform:/resource/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine2FlatStateMachine.qvtcas"/>
+<mapEntry key="QVTi" value="platform:/resource/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine2FlatStateMachine.qvtias"/>
+<mapEntry key="QVTm" value="platform:/resource/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine2FlatStateMachine.qvtm.qvtcas"/>
+<mapEntry key="QVTp" value="platform:/resource/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine2FlatStateMachine.qvtp.qvtcas"/>
+<mapEntry key="QVTr" value="platform:/resource/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine2FlatStateMachine.qvtras"/>
+<mapEntry key="QVTs" value="platform:/resource/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine2FlatStateMachine.qvts.xmi"/>
+<mapEntry key="QVTu" value="platform:/resource/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine2FlatStateMachine.qvtu.qvtcas"/>
+</mapAttribute>
+<booleanAttribute key="interpreted" value="true"/>
+<stringAttribute key="mode" value="ENFORCE - CREATE"/>
+<mapAttribute key="old-in"/>
+<mapAttribute key="old-out"/>
+<mapAttribute key="out">
+<mapEntry key="flat" value="platform:/resource/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/SimpleFlatModel.xmi"/>
+</mapAttribute>
+<stringAttribute key="tx" value="platform:/resource/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine2FlatStateMachine.qvtr"/>
+<booleanAttribute key="view" value="false"/>
+</launchConfiguration>
diff --git a/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.settings/org.eclipse.jdt.core.prefs b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..0c68a61dc --- /dev/null +++ b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/META-INF/MANIFEST.MF b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/META-INF/MANIFEST.MF new file mode 100644 index 000000000..de3929192 --- /dev/null +++ b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/META-INF/MANIFEST.MF @@ -0,0 +1,8 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.qvtd.examples.qvtrelation.hstm2fstm;singleton:=true +Bundle-Version: 0.13.0.qualifier +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/about.html b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/about.html new file mode 100644 index 000000000..132891db1 --- /dev/null +++ b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/about.html @@ -0,0 +1,25 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"><head> + + +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>About</title> +</head><body lang="EN-US"> +<h2>About This Content</h2> + +<p><em>July 30, 2009</em></p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this project ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> +</body></html>
\ No newline at end of file diff --git a/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/build.properties b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/build.properties new file mode 100644 index 000000000..87922d01d --- /dev/null +++ b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/build.properties @@ -0,0 +1,8 @@ +source.. = src/,\ + src-gen/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + about.html,\ + plugin.properties +src.includes = about.html diff --git a/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/plugin.properties b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/plugin.properties new file mode 100644 index 000000000..9e4e0b8df --- /dev/null +++ b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/plugin.properties @@ -0,0 +1,13 @@ +############################################################################### +# Copyright (c) 2016 Eclipse Modeling Project and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# E.D.Willink - initial API and implementation +############################################################################### + +pluginName = QVTrelation HSTM2FSTM example +providerName = Eclipse Modeling Project diff --git a/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/FlatStateMachine.ecore b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/FlatStateMachine.ecore new file mode 100644 index 000000000..2dc03e1e5 --- /dev/null +++ b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/FlatStateMachine.ecore @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="FlatStateMachine" nsURI="http://www.eclipse.org/qvtd/examples/qvtrelation/hstm2fstm/FlatStateMachine"
+ nsPrefix="fstm">
+ <eClassifiers xsi:type="ecore:EClass" name="State">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="owningStateMachine" lowerBound="1"
+ eType="#//StateMachine" eOpposite="#//StateMachine/ownedStates"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="outTransitions" ordered="false"
+ upperBound="-1" eType="#//Transition" eOpposite="#//Transition/fromState"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="inTransitions" ordered="false"
+ upperBound="-1" eType="#//Transition" eOpposite="#//Transition/toState"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Transition">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="owningStateMachine" lowerBound="1"
+ eType="#//StateMachine" eOpposite="#//StateMachine/ownedTransitions"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="fromState" ordered="false"
+ lowerBound="1" eType="#//State" eOpposite="#//State/outTransitions"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="toState" ordered="false"
+ lowerBound="1" eType="#//State" eOpposite="#//State/inTransitions"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="StateMachine">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="ownedStates" ordered="false"
+ upperBound="-1" eType="#//State" containment="true" eOpposite="#//State/owningStateMachine"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="ownedTransitions" ordered="false"
+ upperBound="-1" eType="#//Transition" containment="true" eOpposite="#//Transition/owningStateMachine"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine.ecore b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine.ecore new file mode 100644 index 000000000..6a8a08f94 --- /dev/null +++ b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine.ecore @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="HierarchicalStateMachine" nsURI="http://www.eclipse.org/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine"
+ nsPrefix="hstm">
+ <eClassifiers xsi:type="ecore:EClass" name="State">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="owningStateMachine" lowerBound="1"
+ eType="#//StateMachine" eOpposite="#//StateMachine/ownedStates"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="nestedStates" ordered="false"
+ upperBound="-1" eType="#//State" eOpposite="#//State/nestingState"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="nestingState" ordered="false"
+ eType="#//State" eOpposite="#//State/nestedStates"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="outTransitions" ordered="false"
+ upperBound="-1" eType="#//Transition" eOpposite="#//Transition/fromState"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="inTransitions" ordered="false"
+ upperBound="-1" eType="#//Transition" eOpposite="#//Transition/toState"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Transition">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="owningStateMachine" lowerBound="1"
+ eType="#//StateMachine" eOpposite="#//StateMachine/ownedTransitions"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="fromState" ordered="false"
+ lowerBound="1" eType="#//State" eOpposite="#//State/outTransitions"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="toState" ordered="false"
+ lowerBound="1" eType="#//State" eOpposite="#//State/inTransitions"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="StateMachine">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="ownedStates" ordered="false"
+ upperBound="-1" eType="#//State" containment="true" eOpposite="#//State/owningStateMachine"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="ownedTransitions" ordered="false"
+ upperBound="-1" eType="#//Transition" containment="true" eOpposite="#//Transition/owningStateMachine"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine2FlatStateMachine.qvtr b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine2FlatStateMachine.qvtr new file mode 100644 index 000000000..5cf850d9f --- /dev/null +++ b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine2FlatStateMachine.qvtr @@ -0,0 +1,93 @@ +/******************************************************************************* + * Copyright (c) 2007,2008 Tata Consultancy Services and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * TCS - initial implementation for ModelMorf + * E.D.Willink - alignment with evolved specification + * E.D.Willink - rename / comment + *******************************************************************************/ +import hierMM : 'HierarchicalStateMachine.ecore'::HierarchicalStateMachine; +import flatMM : 'FlatStateMachine.ecore'::FlatStateMachine; + +/** + * Transform a hierarchical StateMachine into a flat StateMachine. + */ +transformation org::eclipse::qvtd::examples::qvtrelation::hstm2fstm::HierarchicalStateMachine2FlatStateMachine(hier:hierMM, flat:flatMM) +{ +-- key hierMM::State {name}; +-- key hierMM::Trans {name, fromState, toState}; +-- key flatMM::State {name}; +-- key flatMM::Trans {name, fromState, toState}; + + /** + * Return the leafStates of a given hierarchicalState. + */ + query getLeafStates(hierarchicalState : hierMM::State) : Set(hierMM::State) { + hierarchicalState->closure(nestedStates)?->select(nestedStates->isEmpty()) + } + + /** + * Map each hierarchical StateMachine to a flat StateMachine + */ + top relation HierachicalStateMachine2FlatStateMachine { + domain hier hierarchicalStateMachine : StateMachine { + name = stateMachineName : String{} + }; + enforce domain flat flatStateMachine : StateMachine { + name = stateMachineName + }; + } + + /** + * Map each Leaf State to a Flat State in the corresponding StateMachine. + */ + top relation LeafState2FlatState { + domain hier leafState : State { + owningStateMachine = hierarchicalStateMachine : hierMM::StateMachine{}, + name = stateName : String{} + } {leafState.nestedStates->isEmpty()}; + + enforce domain flat flatState : State { + owningStateMachine = flatStateMachine : StateMachine{}, + name = stateName + }; + when { + HierachicalStateMachine2FlatStateMachine(hierarchicalStateMachine, flatStateMachine); + } + } + + /** + * Map each hierarchical Transition to a Flat Transition in the corresponding StateMachine + * for each combination of possible leaf end states + */ + top relation HierachicalTransition2FlatTransition + { + leafFromStates : Set(hierMM::State) = hierarchicalFromState->closure(nestedStates)->select(nestedStates->isEmpty()); + leafToStates : Set(hierMM::State) = hierarchicalToState->closure(nestedStates)->select(nestedStates->isEmpty()); + leafFromState : hierMM::State; + leafToState : hierMM::State; + domain hier hierarchicalTransition : Transition { + owningStateMachine = hierarchicalStateMachine : StateMachine{}, + name = transitionName : String{}, + fromState = hierarchicalFromState : State{}, + toState = hierarchicalToState : State{} + }; + enforce domain flat flatTransition : Transition { + owningStateMachine = flatStateMachine : StateMachine{}, + name = transitionName, + fromState = flatFromState : State{}, + toState = flatToState : State{} + }; + when { + HierachicalStateMachine2FlatStateMachine(hierarchicalStateMachine, flatStateMachine); + LeafState2FlatState(leafFromState, flatFromState); + LeafState2FlatState(leafToState, flatToState); + leafFromStates->includes(leafFromState); + leafToStates->includes(leafToState); + } + } +} diff --git a/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/SimpleModel.xmi b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/SimpleModel.xmi new file mode 100644 index 000000000..231453ad7 --- /dev/null +++ b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/SimpleModel.xmi @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<hstm:StateMachine
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:hstm="http://www.eclipse.org/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine"
+ xsi:schemaLocation="http://www.eclipse.org/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine HierarchicalStateMachine.ecore"
+ name="sm">
+ <ownedStates
+ outTransitions="//@ownedTransitions.0"
+ name="s1"/>
+ <ownedStates
+ inTransitions="//@ownedTransitions.0"
+ name="s2"/>
+ <ownedTransitions
+ fromState="//@ownedStates.0"
+ toState="//@ownedStates.1"
+ name="t12"/>
+</hstm:StateMachine>
diff --git a/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/SimpleModel_expected.xmi b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/SimpleModel_expected.xmi new file mode 100644 index 000000000..bb433d6e9 --- /dev/null +++ b/examples/org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/SimpleModel_expected.xmi @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<fstm:StateMachine
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:fstm="http://www.eclipse.org/qvtd/examples/qvtrelation/hstm2fstm/FlatStateMachine"
+ xsi:schemaLocation="http://www.eclipse.org/qvtd/examples/qvtrelation/hstm2fstm/FlatStateMachine FlatStateMachine.ecore"
+ name="sm">
+ <ownedStates inTransitions="//@ownedTransitions.0" name="s2"/>
+ <ownedStates outTransitions="//@ownedTransitions.0" name="s1"/>
+ <ownedTransitions fromState="//@ownedStates.1" toState="//@ownedStates.0" name="t12"/>
+</fstm:StateMachine>
diff --git a/examples/org.eclipse.qvtd.examples/buckminster.cspex b/examples/org.eclipse.qvtd.examples/buckminster.cspex index 7445482da..a9d1bb264 100644 --- a/examples/org.eclipse.qvtd.examples/buckminster.cspex +++ b/examples/org.eclipse.qvtd.examples/buckminster.cspex @@ -8,6 +8,7 @@ <dependency name="org.eclipse.qvtd.examples.qvtcore.empty" componentType="unknown"/> <dependency name="org.eclipse.qvtd.examples.qvtcore.uml2rdbms" componentType="unknown"/> <dependency name="org.eclipse.qvtd.examples.qvtrelation.empty" componentType="unknown"/> + <dependency name="org.eclipse.qvtd.examples.qvtrelation.hstm2fstm" componentType="unknown"/> <dependency name="org.eclipse.qvtd.examples.qvtrelation.modelmorf" componentType="unknown"/> <dependency name="org.eclipse.qvtd.examples.qvtrelation.reltocore" componentType="unknown"/> </dependencies> diff --git a/examples/org.eclipse.qvtd.examples/buildZips.xml b/examples/org.eclipse.qvtd.examples/buildZips.xml index 3c6b30c29..cc69bf769 100644 --- a/examples/org.eclipse.qvtd.examples/buildZips.xml +++ b/examples/org.eclipse.qvtd.examples/buildZips.xml @@ -5,6 +5,7 @@ <patternset id="qvtc.excludes" excludes="bin/** qvtcbin/** src-gen/org/**"/> <patternset id="qvtr.excludes" excludes="bin/** qvtrbin/** src/** .settings/** META-INF/** .classpath build.properties about.html"/> + <patternset id="qvtr2.excludes" excludes="bin/** qvtrbin/** src-gen/org/**"/> <target name="zip.examples" depends="init"> <!-- ../../examples is the prefcerred project layout @@ -29,6 +30,9 @@ <zip destfile="zips/qvtr/empty.zip" basedir="${examplesDir}org.eclipse.qvtd.examples.qvtrelation.empty"> <patternset refid="qvtr.excludes"/> </zip> + <zip destfile="zips/qvtr/hstm2fstm.zip" basedir="${examplesDir}org.eclipse.qvtd.examples.qvtrelation.hstm2fstm"> + <patternset refid="qvtr2.excludes"/> + </zip> <zip destfile="zips/qvtr/modelmorf.zip" basedir="${examplesDir}org.eclipse.qvtd.examples.qvtrelation.modelmorf"> <patternset refid="qvtr.excludes"/> </zip> diff --git a/examples/org.eclipse.qvtd.examples/plugin.properties b/examples/org.eclipse.qvtd.examples/plugin.properties index da556846d..4035dd7e8 100644 --- a/examples/org.eclipse.qvtd.examples/plugin.properties +++ b/examples/org.eclipse.qvtd.examples/plugin.properties @@ -34,6 +34,9 @@ EmptyQVTc_description=Create an Empty QVT Core project QVTc_UML2RDBMS_name=QVTc UML2RDBMS Project QVTc_UML2RDBMS_description=Create the UML2RDBMS QVT Core example project +QVTr_HSTM2FSTM_name=QVTr HSTM2FSTM Project +QVTr_HSTM2FSTM_description=Create the HSTM2FSTM QVT Relation example project + EmptyQVTr_name=Empty QVTr Project EmptyQVTr_description=Create an Empty QVT Relation project diff --git a/examples/org.eclipse.qvtd.examples/plugin.xml b/examples/org.eclipse.qvtd.examples/plugin.xml index fd0bb5ced..c782d18b3 100644 --- a/examples/org.eclipse.qvtd.examples/plugin.xml +++ b/examples/org.eclipse.qvtd.examples/plugin.xml @@ -17,7 +17,7 @@ <category id="org.eclipse.qvtd.examples.category" name="%QVT_category" parentCategory="org.eclipse.ui.Examples"/> - <wizard id="org.eclipse.qvtd.examples.qvtcore.empty" + <!--wizard id="org.eclipse.qvtd.examples.qvtcore.empty" canFinishEarly="true" category="org.eclipse.ui.Examples/org.eclipse.qvtd.examples.category" class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard" @@ -25,7 +25,7 @@ name="%EmptyQVTc_name" icon="$nl$/icons/QVTcModelFile.gif"> <description>%EmptyQVTc_description</description> - </wizard> + </wizard--> <wizard id="org.eclipse.qvtd.examples.qvtcore.uml2rdbms" canFinishEarly="true" category="org.eclipse.ui.Examples/org.eclipse.qvtd.examples.category" @@ -35,7 +35,7 @@ icon="$nl$/icons/QVTcModelFile.gif"> <description>%QVTc_UML2RDBMS_description</description> </wizard> - <wizard id="org.eclipse.qvtd.examples.qvtrelation.empty" + <!--wizard id="org.eclipse.qvtd.examples.qvtrelation.empty" canFinishEarly="true" category="org.eclipse.ui.Examples/org.eclipse.qvtd.examples.category" class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard" @@ -43,6 +43,15 @@ name="%EmptyQVTr_name" icon="$nl$/icons/QVTrModelFile.gif"> <description>%EmptyQVTr_description</description> + </wizard--> + <wizard id="org.eclipse.qvtd.examples.qvtrelation.hstm2fstm" + canFinishEarly="true" + category="org.eclipse.ui.Examples/org.eclipse.qvtd.examples.category" + class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard" + project="true" + name="%QVTr_HSTM2FSTM_name" + icon="$nl$/icons/QVTrModelFile.gif"> + <description>%QVTr_HSTM2FSTM_description</description> </wizard> <wizard id="org.eclipse.qvtd.examples.qvtrelation.modelmorf" canFinishEarly="true" @@ -82,6 +91,15 @@ <fileToOpen location="org.eclipse.qvtd.examples.qvtcore.uml2rdbms/src/org/eclipse/qvtd/examples/qvtcore/uml2rdbms/SimpleUML2RDBMS.qvtc" editorID="org.eclipse.qvtd.xtext.qvtcore.QVTcore"/> </example> + <example id="org.eclipse.qvtd.examples.qvtrelation.hstm2fstm" + wizardID="org.eclipse.qvtd.examples.qvtrelation.hstm2fstm" + pageImage="$nl$/icons/QVTrModelFile.gif"> + <projectDescriptor name="org.eclipse.qvtd.examples.qvtrelation.hstm2fstm" + contentURI="zips/qvtr/hstm2fstm.zip" + description="%QVTr_HSTM2FSTM_description"/> + <fileToOpen location="org.eclipse.qvtd.examples.qvtrelation.hstm2fstm/src/org/eclipse/qvtd/examples/qvtrelation/hstm2fstm/HierarchicalStateMachine2FlatStateMachine.qvtr" + editorID="org.eclipse.qvtd.xtext.qvtrelation.QVTrelation"/> + </example> </extension> <extension point="org.eclipse.ui.intro.configExtension"> |