Переглянути джерело

Added SGraph Validation Rule and Test for 'Choices must have at least one outgoing transition'

Andreas Mülder 13 роки тому
батько
коміт
b8d0d7897f
17 змінених файлів з 612 додано та 694 видалено
  1. 127 120
      plugins/org.yakindu.sct.model.sgraph/model/emf/sgraph.ecore
  2. 1 1
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/Choice.java
  3. 1 1
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/Entry.java
  4. 1 1
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/FinalState.java
  5. 1 1
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/Vertex.java
  6. 0 5
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/CompositeElementImpl.java
  7. 0 1
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/RegularStateImpl.java
  8. 1 1
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/SGraphFactoryImpl.java
  9. 0 1
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/SGraphPackageImpl.java
  10. 0 3
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/SpecificationElementImpl.java
  11. 236 369
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/StateImpl.java
  12. 0 1
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/StatechartImpl.java
  13. 0 2
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/StatementImpl.java
  14. 126 119
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/sgraph.ecore
  15. 25 1
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/util/SGraphAdapterFactory.java
  16. 62 61
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/util/SGraphValidator.java
  17. 31 6
      test-plugins/org.yakindu.sct.model.sgraph.test/src/org/yakindu/sct/model/sgraph/test/SGraphBaseValidationTest.java

+ 127 - 120
plugins/org.yakindu.sct.model.sgraph/model/emf/sgraph.ecore

@@ -1,120 +1,127 @@
-<?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="sgraph"
-    nsURI="http://www.yakindu.org/sct/sgraph/2.0.0" nsPrefix="sgraph">
-  <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Pseudostate" abstract="true" eSuperTypes="#//Vertex"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Vertex" abstract="true" eSuperTypes="../../../org.yakindu.base.types/model/base.ecore#//NamedElement">
-    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="IncomingTransitionCount OutgoingTransitionCount"/>
-    </eAnnotations>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="parentRegion" ordered="false"
-        lowerBound="1" eType="#//Region" eOpposite="#//Region/vertices"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="incomingTransitions" ordered="false"
-        upperBound="-1" eType="#//Transition" eOpposite="#//Transition/target"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="outgoingTransitions" ordered="false"
-        upperBound="-1" eType="#//Transition" containment="true" eOpposite="#//Transition/source"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Region" eSuperTypes="../../../org.yakindu.base.types/model/base.ecore#//NamedElement">
-    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="ExactlyOneInitialState"/>
-    </eAnnotations>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="vertices" ordered="false"
-        upperBound="-1" eType="#//Vertex" containment="true" eOpposite="#//Vertex/parentRegion"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="priority" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="composite" lowerBound="1"
-        eType="#//CompositeElement" eOpposite="#//CompositeElement/regions"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Transition" eSuperTypes="#//SpecificationElement #//Reaction">
-    <eAnnotations source="InjectMembers"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="target" ordered="false"
-        lowerBound="1" eType="#//Vertex" eOpposite="#//Vertex/incomingTransitions"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="source" ordered="false"
-        lowerBound="1" eType="#//Vertex" eOpposite="#//Vertex/outgoingTransitions"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="priority" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="FinalState" eSuperTypes="#//RegularState"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Variable" abstract="true" eSuperTypes="#//Declaration"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Event" abstract="true" eSuperTypes="#//Declaration"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Choice" eSuperTypes="#//Pseudostate">
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//ChoiceKind"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Statechart" eSuperTypes="#//SpecificationElement #//ReactiveElement #//ScopedElement #//CompositeElement ../../../org.yakindu.base.types/model/base.ecore#//NamedElement">
-    <eAnnotations source="InjectMembers"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Entry" eSuperTypes="#//Pseudostate">
-    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="DisallowTrigger"/>
-    </eAnnotations>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//EntryKind"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Trigger" abstract="true"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Effect" abstract="true"/>
-  <eClassifiers xsi:type="ecore:EClass" name="SpecificationElement" abstract="true">
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="specification" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Declaration" abstract="true" eSuperTypes="../../../org.yakindu.base.types/model/base.ecore#//NamedElement"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Reaction" abstract="true">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="trigger" eType="#//Trigger"
-        transient="true" containment="true"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="effect" eType="#//Effect"
-        transient="true" containment="true"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EEnum" name="EntryKind">
-    <eLiterals name="initial" literal="INITIAL"/>
-    <eLiterals name="shallowHistory" value="1" literal="SHALLOW_HISTORY"/>
-    <eLiterals name="deepHistory" value="2" literal="DEEP_HISTORY"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="ReactiveElement" abstract="true">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="reactions" upperBound="-1"
-        eType="#//Reaction" changeable="false" volatile="true" transient="true" derived="true"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="localReactions" upperBound="-1"
-        eType="#//Reaction" changeable="false" volatile="true" transient="true" derived="true"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Exit" eSuperTypes="#//Pseudostate"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Scope">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="declarations" upperBound="-1"
-        eType="#//Declaration" containment="true"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="events" upperBound="-1"
-        eType="#//Event" changeable="false" volatile="true" transient="true" derived="true"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="variables" unique="false"
-        upperBound="-1" eType="#//Variable" changeable="false" volatile="true" transient="true"
-        derived="true"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="ScopedElement" abstract="true">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="scopes" upperBound="-1"
-        eType="#//Scope" transient="true" containment="true"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="namespace" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Synchronization" eSuperTypes="#//Pseudostate"/>
-  <eClassifiers xsi:type="ecore:EClass" name="State" eSuperTypes="#//SpecificationElement #//ReactiveElement #//ScopedElement #//RegularState #//CompositeElement">
-    <eAnnotations source="InjectMembers"/>
-    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="NameIsNotEmpty"/>
-    </eAnnotations>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="orthogonal" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
-        changeable="false" volatile="true" transient="true" derived="true"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="substatechart" eType="#//Statechart"
-        transient="true"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="substatechartId" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="subchart" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
-        changeable="false" volatile="true" transient="true" derived="true"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="simple" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
-        changeable="false" volatile="true" transient="true" derived="true"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="composite" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
-        changeable="false" volatile="true" transient="true" derived="true"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="leaf" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
-        changeable="false" volatile="true" transient="true" derived="true"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Statement"/>
-  <eClassifiers xsi:type="ecore:EClass" name="RegularState" eSuperTypes="#//Vertex"/>
-  <eClassifiers xsi:type="ecore:EEnum" name="ChoiceKind">
-    <eLiterals name="dynamic"/>
-    <eLiterals name="static" value="1"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="CompositeElement" abstract="true">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="regions" upperBound="-1"
-        eType="#//Region" containment="true" eOpposite="#//Region/composite"/>
-  </eClassifiers>
-</ecore:EPackage>
+<?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="sgraph"
+    nsURI="http://www.yakindu.org/sct/sgraph/2.0.0" nsPrefix="sgraph">
+  <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"/>
+  <eClassifiers xsi:type="ecore:EClass" name="Pseudostate" abstract="true" eSuperTypes="#//Vertex"/>
+  <eClassifiers xsi:type="ecore:EClass" name="Vertex" abstract="true" eSuperTypes="../../../org.yakindu.base.types/model/base.ecore#//NamedElement">
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="IncomingTransitionCount"/>
+    </eAnnotations>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="parentRegion" ordered="false"
+        lowerBound="1" eType="#//Region" eOpposite="#//Region/vertices"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="incomingTransitions" ordered="false"
+        upperBound="-1" eType="#//Transition" eOpposite="#//Transition/target"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="outgoingTransitions" ordered="false"
+        upperBound="-1" eType="#//Transition" containment="true" eOpposite="#//Transition/source"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Region" eSuperTypes="../../../org.yakindu.base.types/model/base.ecore#//NamedElement">
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="ExactlyOneInitialState"/>
+    </eAnnotations>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="vertices" ordered="false"
+        upperBound="-1" eType="#//Vertex" containment="true" eOpposite="#//Vertex/parentRegion"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="priority" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="composite" lowerBound="1"
+        eType="#//CompositeElement" eOpposite="#//CompositeElement/regions"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Transition" eSuperTypes="#//SpecificationElement #//Reaction">
+    <eAnnotations source="InjectMembers"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="target" ordered="false"
+        lowerBound="1" eType="#//Vertex" eOpposite="#//Vertex/incomingTransitions"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="source" ordered="false"
+        lowerBound="1" eType="#//Vertex" eOpposite="#//Vertex/outgoingTransitions"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="priority" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="FinalState" eSuperTypes="#//RegularState">
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="OutgoingTransitionCount"/>
+    </eAnnotations>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Variable" abstract="true" eSuperTypes="#//Declaration"/>
+  <eClassifiers xsi:type="ecore:EClass" name="Event" abstract="true" eSuperTypes="#//Declaration"/>
+  <eClassifiers xsi:type="ecore:EClass" name="Choice" eSuperTypes="#//Pseudostate">
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="OutgoingTransitionCount"/>
+    </eAnnotations>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//ChoiceKind"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Statechart" eSuperTypes="#//SpecificationElement #//ReactiveElement #//ScopedElement #//CompositeElement ../../../org.yakindu.base.types/model/base.ecore#//NamedElement">
+    <eAnnotations source="InjectMembers"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Entry" eSuperTypes="#//Pseudostate">
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="DisallowTrigger OutgoingTransitionCount"/>
+    </eAnnotations>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//EntryKind"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Trigger" abstract="true"/>
+  <eClassifiers xsi:type="ecore:EClass" name="Effect" abstract="true"/>
+  <eClassifiers xsi:type="ecore:EClass" name="SpecificationElement" abstract="true">
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="specification" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Declaration" abstract="true" eSuperTypes="../../../org.yakindu.base.types/model/base.ecore#//NamedElement"/>
+  <eClassifiers xsi:type="ecore:EClass" name="Reaction" abstract="true">
+    <eStructuralFeatures xsi:type="ecore:EReference" name="trigger" eType="#//Trigger"
+        transient="true" containment="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="effect" eType="#//Effect"
+        transient="true" containment="true"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EEnum" name="EntryKind">
+    <eLiterals name="initial" literal="INITIAL"/>
+    <eLiterals name="shallowHistory" value="1" literal="SHALLOW_HISTORY"/>
+    <eLiterals name="deepHistory" value="2" literal="DEEP_HISTORY"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="ReactiveElement" abstract="true">
+    <eStructuralFeatures xsi:type="ecore:EReference" name="reactions" upperBound="-1"
+        eType="#//Reaction" changeable="false" volatile="true" transient="true" derived="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="localReactions" upperBound="-1"
+        eType="#//Reaction" changeable="false" volatile="true" transient="true" derived="true"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Exit" eSuperTypes="#//Pseudostate"/>
+  <eClassifiers xsi:type="ecore:EClass" name="Scope">
+    <eStructuralFeatures xsi:type="ecore:EReference" name="declarations" upperBound="-1"
+        eType="#//Declaration" containment="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="events" upperBound="-1"
+        eType="#//Event" changeable="false" volatile="true" transient="true" derived="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="variables" unique="false"
+        upperBound="-1" eType="#//Variable" changeable="false" volatile="true" transient="true"
+        derived="true"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="ScopedElement" abstract="true">
+    <eStructuralFeatures xsi:type="ecore:EReference" name="scopes" upperBound="-1"
+        eType="#//Scope" transient="true" containment="true"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="namespace" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Synchronization" eSuperTypes="#//Pseudostate"/>
+  <eClassifiers xsi:type="ecore:EClass" name="State" eSuperTypes="#//SpecificationElement #//ReactiveElement #//ScopedElement #//RegularState #//CompositeElement">
+    <eAnnotations source="InjectMembers"/>
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="NameIsNotEmpty"/>
+    </eAnnotations>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="orthogonal" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+        changeable="false" volatile="true" transient="true" derived="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="substatechart" eType="#//Statechart"
+        transient="true"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="substatechartId" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="subchart" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+        changeable="false" volatile="true" transient="true" derived="true"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="simple" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+        changeable="false" volatile="true" transient="true" derived="true"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="composite" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+        changeable="false" volatile="true" transient="true" derived="true"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="leaf" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+        changeable="false" volatile="true" transient="true" derived="true"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Statement"/>
+  <eClassifiers xsi:type="ecore:EClass" name="RegularState" eSuperTypes="#//Vertex"/>
+  <eClassifiers xsi:type="ecore:EEnum" name="ChoiceKind">
+    <eLiterals name="dynamic"/>
+    <eLiterals name="static" value="1"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="CompositeElement" abstract="true">
+    <eStructuralFeatures xsi:type="ecore:EReference" name="regions" upperBound="-1"
+        eType="#//Region" containment="true" eOpposite="#//Region/composite"/>
+  </eClassifiers>
+</ecore:EPackage>

+ 1 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/Choice.java

@@ -24,7 +24,7 @@ package org.yakindu.sct.model.sgraph;
  * </p>
  *
  * @see org.yakindu.sct.model.sgraph.SGraphPackage#getChoice()
- * @model
+ * @model annotation="http://www.eclipse.org/emf/2002/Ecore constraints='OutgoingTransitionCount'"
  * @generated
  */
 public interface Choice extends Pseudostate {

+ 1 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/Entry.java

@@ -24,7 +24,7 @@ package org.yakindu.sct.model.sgraph;
  * </p>
  *
  * @see org.yakindu.sct.model.sgraph.SGraphPackage#getEntry()
- * @model annotation="http://www.eclipse.org/emf/2002/Ecore constraints='DisallowTrigger'"
+ * @model annotation="http://www.eclipse.org/emf/2002/Ecore constraints='DisallowTrigger OutgoingTransitionCount'"
  * @generated
  */
 public interface Entry extends Pseudostate {

+ 1 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/FinalState.java

@@ -19,7 +19,7 @@ package org.yakindu.sct.model.sgraph;
  *
  *
  * @see org.yakindu.sct.model.sgraph.SGraphPackage#getFinalState()
- * @model
+ * @model annotation="http://www.eclipse.org/emf/2002/Ecore constraints='OutgoingTransitionCount'"
  * @generated
  */
 public interface FinalState extends RegularState {

+ 1 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/Vertex.java

@@ -29,7 +29,7 @@ import org.yakindu.base.base.NamedElement;
  *
  * @see org.yakindu.sct.model.sgraph.SGraphPackage#getVertex()
  * @model abstract="true"
- *        annotation="http://www.eclipse.org/emf/2002/Ecore constraints='IncomingTransitionCount OutgoingTransitionCount'"
+ *        annotation="http://www.eclipse.org/emf/2002/Ecore constraints='IncomingTransitionCount'"
  * @generated
  */
 public interface Vertex extends NamedElement {

+ 0 - 5
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/CompositeElementImpl.java

@@ -13,17 +13,12 @@ package org.yakindu.sct.model.sgraph.impl;
 import java.util.Collection;
 
 import org.eclipse.emf.common.notify.NotificationChain;
-
 import org.eclipse.emf.common.util.EList;
-
 import org.eclipse.emf.ecore.EClass;
 import org.eclipse.emf.ecore.InternalEObject;
-
 import org.eclipse.emf.ecore.impl.EObjectImpl;
-
 import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
 import org.eclipse.emf.ecore.util.InternalEList;
-
 import org.yakindu.sct.model.sgraph.CompositeElement;
 import org.yakindu.sct.model.sgraph.Region;
 import org.yakindu.sct.model.sgraph.SGraphPackage;

+ 0 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/RegularStateImpl.java

@@ -11,7 +11,6 @@
 package org.yakindu.sct.model.sgraph.impl;
 
 import org.eclipse.emf.ecore.EClass;
-
 import org.yakindu.sct.model.sgraph.RegularState;
 import org.yakindu.sct.model.sgraph.SGraphPackage;
 

+ 1 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/SGraphFactoryImpl.java

@@ -16,8 +16,8 @@ import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.impl.EFactoryImpl;
 import org.eclipse.emf.ecore.plugin.EcorePlugin;
-import org.yakindu.sct.model.sgraph.*;
 import org.yakindu.sct.model.sgraph.Choice;
+import org.yakindu.sct.model.sgraph.ChoiceKind;
 import org.yakindu.sct.model.sgraph.Entry;
 import org.yakindu.sct.model.sgraph.EntryKind;
 import org.yakindu.sct.model.sgraph.Exit;

+ 0 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/SGraphPackageImpl.java

@@ -22,7 +22,6 @@ import org.eclipse.emf.ecore.EEnum;
 import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.EReference;
 import org.eclipse.emf.ecore.EValidator;
-import org.eclipse.emf.ecore.EcorePackage;
 import org.eclipse.emf.ecore.impl.EPackageImpl;
 import org.eclipse.emf.ecore.resource.Resource;
 import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;

+ 0 - 3
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/SpecificationElementImpl.java

@@ -11,12 +11,9 @@
 package org.yakindu.sct.model.sgraph.impl;
 
 import org.eclipse.emf.common.notify.Notification;
-
 import org.eclipse.emf.ecore.EClass;
-
 import org.eclipse.emf.ecore.impl.ENotificationImpl;
 import org.eclipse.emf.ecore.impl.EObjectImpl;
-
 import org.yakindu.sct.model.sgraph.SGraphPackage;
 import org.yakindu.sct.model.sgraph.SpecificationElement;
 

Різницю між файлами не показано, бо вона завелика
+ 236 - 369
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/StateImpl.java


+ 0 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/StatechartImpl.java

@@ -32,7 +32,6 @@ import org.yakindu.sct.model.sgraph.Region;
 import org.yakindu.sct.model.sgraph.SGraphPackage;
 import org.yakindu.sct.model.sgraph.Scope;
 import org.yakindu.sct.model.sgraph.ScopedElement;
-import org.yakindu.sct.model.sgraph.SpecificationElement;
 import org.yakindu.sct.model.sgraph.Statechart;
 
 /**

+ 0 - 2
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/StatementImpl.java

@@ -11,9 +11,7 @@
 package org.yakindu.sct.model.sgraph.impl;
 
 import org.eclipse.emf.ecore.EClass;
-
 import org.eclipse.emf.ecore.impl.EObjectImpl;
-
 import org.yakindu.sct.model.sgraph.SGraphPackage;
 import org.yakindu.sct.model.sgraph.Statement;
 

+ 126 - 119
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/sgraph.ecore

@@ -1,119 +1,126 @@
-<?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="sgraph"
-    nsURI="http://www.yakindu.org/sct/sgraph/2.0.0" nsPrefix="sgraph">
-  <eClassifiers xsi:type="ecore:EClass" name="Pseudostate" abstract="true" eSuperTypes="#//Vertex"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Vertex" abstract="true" eSuperTypes="http://www.yakindu.org/base/base/2.0.0#//NamedElement">
-    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="IncomingTransitionCount OutgoingTransitionCount"/>
-    </eAnnotations>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="parentRegion" ordered="false"
-        lowerBound="1" eType="#//Region" eOpposite="#//Region/vertices"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="incomingTransitions" ordered="false"
-        upperBound="-1" eType="#//Transition" eOpposite="#//Transition/target"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="outgoingTransitions" ordered="false"
-        upperBound="-1" eType="#//Transition" containment="true" eOpposite="#//Transition/source"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Region" eSuperTypes="http://www.yakindu.org/base/base/2.0.0#//NamedElement">
-    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="ExactlyOneInitialState"/>
-    </eAnnotations>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="vertices" ordered="false"
-        upperBound="-1" eType="#//Vertex" containment="true" eOpposite="#//Vertex/parentRegion"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="priority" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="composite" lowerBound="1"
-        eType="#//CompositeElement" eOpposite="#//CompositeElement/regions"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Transition" eSuperTypes="#//SpecificationElement #//Reaction">
-    <eAnnotations source="InjectMembers"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="target" ordered="false"
-        lowerBound="1" eType="#//Vertex" eOpposite="#//Vertex/incomingTransitions"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="source" ordered="false"
-        lowerBound="1" eType="#//Vertex" eOpposite="#//Vertex/outgoingTransitions"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="priority" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="FinalState" eSuperTypes="#//RegularState"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Variable" abstract="true" eSuperTypes="#//Declaration"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Event" abstract="true" eSuperTypes="#//Declaration"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Choice" eSuperTypes="#//Pseudostate">
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//ChoiceKind"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Statechart" eSuperTypes="#//SpecificationElement #//ReactiveElement #//ScopedElement #//CompositeElement http://www.yakindu.org/base/base/2.0.0#//NamedElement">
-    <eAnnotations source="InjectMembers"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Entry" eSuperTypes="#//Pseudostate">
-    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="DisallowTrigger"/>
-    </eAnnotations>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//EntryKind"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Trigger" abstract="true"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Effect" abstract="true"/>
-  <eClassifiers xsi:type="ecore:EClass" name="SpecificationElement" abstract="true">
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="specification" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Declaration" abstract="true" eSuperTypes="http://www.yakindu.org/base/base/2.0.0#//NamedElement"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Reaction" abstract="true">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="trigger" eType="#//Trigger"
-        transient="true" containment="true"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="effect" eType="#//Effect"
-        transient="true" containment="true"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EEnum" name="EntryKind">
-    <eLiterals name="initial" literal="INITIAL"/>
-    <eLiterals name="shallowHistory" value="1" literal="SHALLOW_HISTORY"/>
-    <eLiterals name="deepHistory" value="2" literal="DEEP_HISTORY"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="ReactiveElement" abstract="true">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="reactions" upperBound="-1"
-        eType="#//Reaction" changeable="false" volatile="true" transient="true" derived="true"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="localReactions" upperBound="-1"
-        eType="#//Reaction" changeable="false" volatile="true" transient="true" derived="true"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Exit" eSuperTypes="#//Pseudostate"/>
-  <eClassifiers xsi:type="ecore:EClass" name="Scope">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="declarations" upperBound="-1"
-        eType="#//Declaration" containment="true"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="events" upperBound="-1"
-        eType="#//Event" changeable="false" volatile="true" transient="true" derived="true"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="variables" unique="false"
-        upperBound="-1" eType="#//Variable" changeable="false" volatile="true" transient="true"
-        derived="true"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="ScopedElement" abstract="true">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="scopes" upperBound="-1"
-        eType="#//Scope" transient="true" containment="true"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="namespace" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Synchronization" eSuperTypes="#//Pseudostate"/>
-  <eClassifiers xsi:type="ecore:EClass" name="State" eSuperTypes="#//SpecificationElement #//ReactiveElement #//ScopedElement #//RegularState #//CompositeElement">
-    <eAnnotations source="InjectMembers"/>
-    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="NameIsNotEmpty"/>
-    </eAnnotations>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="orthogonal" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
-        changeable="false" volatile="true" transient="true" derived="true"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="substatechart" eType="#//Statechart"
-        transient="true"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="substatechartId" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="subchart" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
-        changeable="false" volatile="true" transient="true" derived="true"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="simple" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
-        changeable="false" volatile="true" transient="true" derived="true"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="composite" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
-        changeable="false" volatile="true" transient="true" derived="true"/>
-    <eStructuralFeatures xsi:type="ecore:EAttribute" name="leaf" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
-        changeable="false" volatile="true" transient="true" derived="true"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Statement"/>
-  <eClassifiers xsi:type="ecore:EClass" name="RegularState" eSuperTypes="#//Vertex"/>
-  <eClassifiers xsi:type="ecore:EEnum" name="ChoiceKind">
-    <eLiterals name="dynamic"/>
-    <eLiterals name="static" value="1"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="CompositeElement" abstract="true">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="regions" upperBound="-1"
-        eType="#//Region" containment="true" eOpposite="#//Region/composite"/>
-  </eClassifiers>
-</ecore:EPackage>
+<?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="sgraph"
+    nsURI="http://www.yakindu.org/sct/sgraph/2.0.0" nsPrefix="sgraph">
+  <eClassifiers xsi:type="ecore:EClass" name="Pseudostate" abstract="true" eSuperTypes="#//Vertex"/>
+  <eClassifiers xsi:type="ecore:EClass" name="Vertex" abstract="true" eSuperTypes="http://www.yakindu.org/base/base/2.0.0#//NamedElement">
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="IncomingTransitionCount"/>
+    </eAnnotations>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="parentRegion" ordered="false"
+        lowerBound="1" eType="#//Region" eOpposite="#//Region/vertices"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="incomingTransitions" ordered="false"
+        upperBound="-1" eType="#//Transition" eOpposite="#//Transition/target"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="outgoingTransitions" ordered="false"
+        upperBound="-1" eType="#//Transition" containment="true" eOpposite="#//Transition/source"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Region" eSuperTypes="http://www.yakindu.org/base/base/2.0.0#//NamedElement">
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="ExactlyOneInitialState"/>
+    </eAnnotations>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="vertices" ordered="false"
+        upperBound="-1" eType="#//Vertex" containment="true" eOpposite="#//Vertex/parentRegion"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="priority" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="composite" lowerBound="1"
+        eType="#//CompositeElement" eOpposite="#//CompositeElement/regions"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Transition" eSuperTypes="#//SpecificationElement #//Reaction">
+    <eAnnotations source="InjectMembers"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="target" ordered="false"
+        lowerBound="1" eType="#//Vertex" eOpposite="#//Vertex/incomingTransitions"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="source" ordered="false"
+        lowerBound="1" eType="#//Vertex" eOpposite="#//Vertex/outgoingTransitions"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="priority" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="FinalState" eSuperTypes="#//RegularState">
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="OutgoingTransitionCount"/>
+    </eAnnotations>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Variable" abstract="true" eSuperTypes="#//Declaration"/>
+  <eClassifiers xsi:type="ecore:EClass" name="Event" abstract="true" eSuperTypes="#//Declaration"/>
+  <eClassifiers xsi:type="ecore:EClass" name="Choice" eSuperTypes="#//Pseudostate">
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="OutgoingTransitionCount"/>
+    </eAnnotations>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//ChoiceKind"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Statechart" eSuperTypes="#//SpecificationElement #//ReactiveElement #//ScopedElement #//CompositeElement http://www.yakindu.org/base/base/2.0.0#//NamedElement">
+    <eAnnotations source="InjectMembers"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Entry" eSuperTypes="#//Pseudostate">
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="DisallowTrigger OutgoingTransitionCount"/>
+    </eAnnotations>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//EntryKind"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Trigger" abstract="true"/>
+  <eClassifiers xsi:type="ecore:EClass" name="Effect" abstract="true"/>
+  <eClassifiers xsi:type="ecore:EClass" name="SpecificationElement" abstract="true">
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="specification" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Declaration" abstract="true" eSuperTypes="http://www.yakindu.org/base/base/2.0.0#//NamedElement"/>
+  <eClassifiers xsi:type="ecore:EClass" name="Reaction" abstract="true">
+    <eStructuralFeatures xsi:type="ecore:EReference" name="trigger" eType="#//Trigger"
+        transient="true" containment="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="effect" eType="#//Effect"
+        transient="true" containment="true"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EEnum" name="EntryKind">
+    <eLiterals name="initial" literal="INITIAL"/>
+    <eLiterals name="shallowHistory" value="1" literal="SHALLOW_HISTORY"/>
+    <eLiterals name="deepHistory" value="2" literal="DEEP_HISTORY"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="ReactiveElement" abstract="true">
+    <eStructuralFeatures xsi:type="ecore:EReference" name="reactions" upperBound="-1"
+        eType="#//Reaction" changeable="false" volatile="true" transient="true" derived="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="localReactions" upperBound="-1"
+        eType="#//Reaction" changeable="false" volatile="true" transient="true" derived="true"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Exit" eSuperTypes="#//Pseudostate"/>
+  <eClassifiers xsi:type="ecore:EClass" name="Scope">
+    <eStructuralFeatures xsi:type="ecore:EReference" name="declarations" upperBound="-1"
+        eType="#//Declaration" containment="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="events" upperBound="-1"
+        eType="#//Event" changeable="false" volatile="true" transient="true" derived="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="variables" unique="false"
+        upperBound="-1" eType="#//Variable" changeable="false" volatile="true" transient="true"
+        derived="true"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="ScopedElement" abstract="true">
+    <eStructuralFeatures xsi:type="ecore:EReference" name="scopes" upperBound="-1"
+        eType="#//Scope" transient="true" containment="true"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="namespace" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Synchronization" eSuperTypes="#//Pseudostate"/>
+  <eClassifiers xsi:type="ecore:EClass" name="State" eSuperTypes="#//SpecificationElement #//ReactiveElement #//ScopedElement #//RegularState #//CompositeElement">
+    <eAnnotations source="InjectMembers"/>
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="NameIsNotEmpty"/>
+    </eAnnotations>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="orthogonal" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+        changeable="false" volatile="true" transient="true" derived="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="substatechart" eType="#//Statechart"
+        transient="true"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="substatechartId" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="subchart" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+        changeable="false" volatile="true" transient="true" derived="true"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="simple" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+        changeable="false" volatile="true" transient="true" derived="true"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="composite" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+        changeable="false" volatile="true" transient="true" derived="true"/>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="leaf" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+        changeable="false" volatile="true" transient="true" derived="true"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Statement"/>
+  <eClassifiers xsi:type="ecore:EClass" name="RegularState" eSuperTypes="#//Vertex"/>
+  <eClassifiers xsi:type="ecore:EEnum" name="ChoiceKind">
+    <eLiterals name="dynamic"/>
+    <eLiterals name="static" value="1"/>
+  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="CompositeElement" abstract="true">
+    <eStructuralFeatures xsi:type="ecore:EReference" name="regions" upperBound="-1"
+        eType="#//Region" containment="true" eOpposite="#//Region/composite"/>
+  </eClassifiers>
+</ecore:EPackage>

+ 25 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/util/SGraphAdapterFactory.java

@@ -15,7 +15,31 @@ import org.eclipse.emf.common.notify.Notifier;
 import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
 import org.eclipse.emf.ecore.EObject;
 import org.yakindu.base.base.NamedElement;
-import org.yakindu.sct.model.sgraph.*;
+import org.yakindu.sct.model.sgraph.Choice;
+import org.yakindu.sct.model.sgraph.CompositeElement;
+import org.yakindu.sct.model.sgraph.Declaration;
+import org.yakindu.sct.model.sgraph.Effect;
+import org.yakindu.sct.model.sgraph.Entry;
+import org.yakindu.sct.model.sgraph.Event;
+import org.yakindu.sct.model.sgraph.Exit;
+import org.yakindu.sct.model.sgraph.FinalState;
+import org.yakindu.sct.model.sgraph.Pseudostate;
+import org.yakindu.sct.model.sgraph.Reaction;
+import org.yakindu.sct.model.sgraph.ReactiveElement;
+import org.yakindu.sct.model.sgraph.Region;
+import org.yakindu.sct.model.sgraph.RegularState;
+import org.yakindu.sct.model.sgraph.SGraphPackage;
+import org.yakindu.sct.model.sgraph.Scope;
+import org.yakindu.sct.model.sgraph.ScopedElement;
+import org.yakindu.sct.model.sgraph.SpecificationElement;
+import org.yakindu.sct.model.sgraph.State;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.model.sgraph.Statement;
+import org.yakindu.sct.model.sgraph.Synchronization;
+import org.yakindu.sct.model.sgraph.Transition;
+import org.yakindu.sct.model.sgraph.Trigger;
+import org.yakindu.sct.model.sgraph.Variable;
+import org.yakindu.sct.model.sgraph.Vertex;
 
 /**
  * <!-- begin-user-doc -->

+ 62 - 61
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/util/SGraphValidator.java

@@ -69,7 +69,7 @@ public class SGraphValidator extends EObjectValidator {
 	public static final String ISSUE_SUBMACHINESTATE_WITHOUT_SUBMACHINE = "Selected Submachine can not be resolved.";
 	public static final String ISSUE_SUBMACHINESTATE__CYCLE = "A submachine state can not contain itself as as Submachine.";
 	public static final String ISSUE_ENTRY_WITH_TRIGGER = "Outgoing Transitions from Entries can not have a Trigger or Guard.";
-
+	public static final String ISSUE_CHOICE_WITHOUT_OUTGOING_TRANSITION = "A choice must have at least one outgoing transition.";
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
 	 * 
@@ -243,9 +243,6 @@ public class SGraphValidator extends EObjectValidator {
 		if (result || diagnostics != null)
 			result &= validateVertex_IncomingTransitionCount(pseudostate,
 					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateVertex_OutgoingTransitionCount(pseudostate,
-					diagnostics, context);
 		return result;
 	}
 
@@ -280,9 +277,6 @@ public class SGraphValidator extends EObjectValidator {
 		if (result || diagnostics != null)
 			result &= validateVertex_IncomingTransitionCount(vertex,
 					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateVertex_OutgoingTransitionCount(vertex,
-					diagnostics, context);
 		return result;
 	}
 
@@ -313,8 +307,7 @@ public class SGraphValidator extends EObjectValidator {
 				}
 			}
 			return error(vertex, diagnostics, ISSUE_NODE_NOT_REACHABLE);
-		}
-		else if (vertex.getIncomingTransitions().size() == 0
+		} else if (vertex.getIncomingTransitions().size() == 0
 				&& !(vertex instanceof Entry)) {
 			return error(vertex, diagnostics, ISSUE_NODE_NOT_REACHABLE);
 		}
@@ -328,37 +321,6 @@ public class SGraphValidator extends EObjectValidator {
 		return true;
 	}
 
-	/**
-	 * Validates the OutgoingTransitionCount constraint of '<em>Vertex</em>'.
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated NOT
-	 */
-	public boolean validateVertex_OutgoingTransitionCount(Vertex vertex,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-
-		if ((vertex.getOutgoingTransitions().size() > 0)
-				&& (vertex instanceof FinalState)) {
-			return warning(vertex, diagnostics,
-					ISSUE_FINAL_STATE_OUTGOING_TRANSITION);
-		}
-
-		if (vertex.getOutgoingTransitions().size() == 0
-				&& vertex instanceof Entry
-				&& ((Entry) vertex).getKind().equals(EntryKind.INITIAL)) {
-			return warning(vertex, diagnostics,
-					ISSUE_INITIAL_ENTRY_WITHOUT_OUT_TRANS);
-		}
-
-		if (vertex.getOutgoingTransitions().size() > 1
-				&& vertex instanceof Entry) {
-			return error(vertex, diagnostics,
-					ISSUE_ENTRY_WITH_MULTIPLE_OUT_TRANS);
-		}
-
-		return true;
-	}
-
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
 	 * 
@@ -448,11 +410,27 @@ public class SGraphValidator extends EObjectValidator {
 			result &= validateVertex_IncomingTransitionCount(finalState,
 					diagnostics, context);
 		if (result || diagnostics != null)
-			result &= validateVertex_OutgoingTransitionCount(finalState,
+			result &= validateFinalState_OutgoingTransitionCount(finalState,
 					diagnostics, context);
 		return result;
 	}
 
+	/**
+	 * Validates the OutgoingTransitionCount constraint of '<em>Final State</em>
+	 * '. <!-- begin-user-doc --> <!-- end-user-doc -->
+	 * 
+	 * @generated NOT
+	 */
+	public boolean validateFinalState_OutgoingTransitionCount(
+			FinalState finalState, DiagnosticChain diagnostics,
+			Map<Object, Object> context) {
+		if ((finalState.getOutgoingTransitions().size() > 0)) {
+			return warning(finalState, diagnostics,
+					ISSUE_FINAL_STATE_OUTGOING_TRANSITION);
+		}
+		return true;
+	}
+
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
 	 * 
@@ -484,9 +462,6 @@ public class SGraphValidator extends EObjectValidator {
 		if (result || diagnostics != null)
 			result &= validateVertex_IncomingTransitionCount(state,
 					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateVertex_OutgoingTransitionCount(state,
-					diagnostics, context);
 		if (result || diagnostics != null)
 			result &= validateState_NameIsNotEmpty(state, diagnostics, context);
 		return result;
@@ -551,9 +526,6 @@ public class SGraphValidator extends EObjectValidator {
 		if (result || diagnostics != null)
 			result &= validateVertex_IncomingTransitionCount(regularState,
 					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateVertex_OutgoingTransitionCount(regularState,
-					diagnostics, context);
 		return result;
 	}
 
@@ -620,11 +592,26 @@ public class SGraphValidator extends EObjectValidator {
 			result &= validateVertex_IncomingTransitionCount(choice,
 					diagnostics, context);
 		if (result || diagnostics != null)
-			result &= validateVertex_OutgoingTransitionCount(choice,
+			result &= validateChoice_OutgoingTransitionCount(choice,
 					diagnostics, context);
 		return result;
 	}
 
+	/**
+	 * Validates the OutgoingTransitionCount constraint of '<em>Choice</em>'.
+	 * <!-- begin-user-doc --> <!-- end-user-doc -->
+	 * 
+	 * @generated NOT
+	 */
+	public boolean validateChoice_OutgoingTransitionCount(Choice choice,
+			DiagnosticChain diagnostics, Map<Object, Object> context) {
+		// Choice without outgoing transition
+		if (choice.getOutgoingTransitions().size() == 0) {
+			return error(choice, diagnostics, ISSUE_CHOICE_WITHOUT_OUTGOING_TRANSITION);
+		}
+		return true;
+	}
+
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
 	 * 
@@ -666,11 +653,11 @@ public class SGraphValidator extends EObjectValidator {
 		if (result || diagnostics != null)
 			result &= validateVertex_IncomingTransitionCount(entry,
 					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateVertex_OutgoingTransitionCount(entry,
-					diagnostics, context);
 		if (result || diagnostics != null)
 			result &= validateEntry_DisallowTrigger(entry, diagnostics, context);
+		if (result || diagnostics != null)
+			result &= validateEntry_OutgoingTransitionCount(entry, diagnostics,
+					context);
 		return result;
 	}
 
@@ -696,6 +683,26 @@ public class SGraphValidator extends EObjectValidator {
 		return true;
 	}
 
+	/**
+	 * Validates the OutgoingTransitionCount constraint of '<em>Entry</em>'.
+	 * <!-- begin-user-doc --> <!-- end-user-doc -->
+	 * 
+	 * @generated NOT
+	 */
+	public boolean validateEntry_OutgoingTransitionCount(Entry entry,
+			DiagnosticChain diagnostics, Map<Object, Object> context) {
+		if (entry.getOutgoingTransitions().size() == 0
+				&& ((Entry) entry).getKind().equals(EntryKind.INITIAL)) {
+			return warning(entry, diagnostics,
+					ISSUE_INITIAL_ENTRY_WITHOUT_OUT_TRANS);
+		}
+		if (entry.getOutgoingTransitions().size() > 1) {
+			return error(entry, diagnostics,
+					ISSUE_ENTRY_WITH_MULTIPLE_OUT_TRANS);
+		}
+		return true;
+	}
+
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
 	 * 
@@ -791,9 +798,6 @@ public class SGraphValidator extends EObjectValidator {
 		if (result || diagnostics != null)
 			result &= validateVertex_IncomingTransitionCount(exit, diagnostics,
 					context);
-		if (result || diagnostics != null)
-			result &= validateVertex_OutgoingTransitionCount(exit, diagnostics,
-					context);
 		return result;
 	}
 
@@ -853,9 +857,6 @@ public class SGraphValidator extends EObjectValidator {
 		if (result || diagnostics != null)
 			result &= validateVertex_IncomingTransitionCount(synchronization,
 					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateVertex_OutgoingTransitionCount(synchronization,
-					diagnostics, context);
 		return result;
 	}
 
@@ -913,19 +914,19 @@ public class SGraphValidator extends EObjectValidator {
 	}
 
 	protected boolean warning(Vertex vertex, DiagnosticChain diagnostics,
-			String messagen) {
+			String message) {
 		if (diagnostics != null) {
 			diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING,
-					DIAGNOSTIC_SOURCE, 0, messagen, new Object[] { vertex }));
+					DIAGNOSTIC_SOURCE, 0, message, new Object[] { vertex }));
 		}
 		return false;
 	}
 
 	protected boolean error(Vertex vertex, DiagnosticChain diagnostics,
-			String messagen) {
+			String message) {
 		if (diagnostics != null) {
 			diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR,
-					DIAGNOSTIC_SOURCE, 0, messagen, new Object[] { vertex }));
+					DIAGNOSTIC_SOURCE, 0, message, new Object[] { vertex }));
 		}
 		return false;
 	}

+ 31 - 6
test-plugins/org.yakindu.sct.model.sgraph.test/src/org/yakindu/sct/model/sgraph/test/SGraphBaseValidationTest.java

@@ -10,24 +10,26 @@
  */
 package org.yakindu.sct.model.sgraph.test;
 
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 import static org.yakindu.sct.model.sgraph.util.SGraphValidator.ISSUE_ENTRY_WITH_MULTIPLE_OUT_TRANS;
+import static org.yakindu.sct.model.sgraph.util.SGraphValidator.ISSUE_ENTRY_WITH_TRIGGER;
 import static org.yakindu.sct.model.sgraph.util.SGraphValidator.ISSUE_INITIAL_ENTRY_WITHOUT_OUT_TRANS;
 import static org.yakindu.sct.model.sgraph.util.SGraphValidator.ISSUE_INITIAL_ENTRY_WITH_IN_TRANS;
 import static org.yakindu.sct.model.sgraph.util.SGraphValidator.ISSUE_NODE_NOT_REACHABLE;
 import static org.yakindu.sct.model.sgraph.util.SGraphValidator.ISSUE_STATE_WITHOUT_NAME;
 import static org.yakindu.sct.model.sgraph.util.SGraphValidator.ISSUE_STATE_WITHOUT_OUTGOING_TRANSITION;
-import static org.yakindu.sct.model.sgraph.util.SGraphValidator.ISSUE_ENTRY_WITH_TRIGGER;
 
 import java.util.HashMap;
 
-import junit.framework.TestCase;
-
 import org.eclipse.emf.common.util.BasicDiagnostic;
 import org.eclipse.emf.common.util.Diagnostic;
 import org.junit.Before;
 import org.junit.Test;
+import org.yakindu.sct.model.sgraph.Choice;
 import org.yakindu.sct.model.sgraph.Entry;
 import org.yakindu.sct.model.sgraph.EntryKind;
 import org.yakindu.sct.model.sgraph.FinalState;
@@ -297,7 +299,7 @@ public class SGraphBaseValidationTest {
 	}
 
 	/**
-	 * A final state should have at least one incoming transition.
+	 * A final state should have no outgoing transitions
 	 */
 	@Test
 	public void testFinalStateOutgoingTransitions() {
@@ -320,6 +322,29 @@ public class SGraphBaseValidationTest {
 				SGraphValidator.ISSUE_FINAL_STATE_OUTGOING_TRANSITION);
 	}
 
+	/**
+	 * A choice must have at least one outgoing transition
+	 */
+	@Test
+	public void testChoiceOutgoingTransitions() {
+		statechart = factory.createStatechart();
+		Region region = factory.createRegion();
+		statechart.getRegions().add(region);
+		Choice choice = factory.createChoice();
+		region.getVertices().add(choice);
+		State state = factory.createState();
+		region.getVertices().add(state);
+
+		createTransition(state, choice);
+
+		assertFalse(validator.validate(choice, diagnostics,
+				new HashMap<Object, Object>()));
+
+		assertIssueCount(diagnostics, 1);
+		assertError(diagnostics,
+				SGraphValidator.ISSUE_CHOICE_WITHOUT_OUTGOING_TRANSITION);
+	}
+
 	protected Transition createTransition(Vertex source, Vertex target) {
 		Transition trans = factory.createTransition();
 		trans.setSource(source);