Browse Source

Added validation rule: cycles in submachines

Andreas Mülder 14 years ago
parent
commit
cd52dba174

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

@@ -100,7 +100,7 @@
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="SubmachineState" eSuperTypes="#//AbstractState">
     <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="SubStatechartExists"/>
+      <details key="constraints" value="SubStatechartExists SubStatechartIsNotACycle"/>
     </eAnnotations>
     <eStructuralFeatures xsi:type="ecore:EReference" name="substatechart" eType="#//Statechart"/>
   </eClassifiers>

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

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

+ 25 - 40
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/StateImpl.java

@@ -28,27 +28,23 @@ import org.yakindu.sct.model.sgraph.State;
  * <p>
  * The following features are implemented:
  * <ul>
- * <li>{@link org.yakindu.sct.model.sgraph.impl.StateImpl#getSubRegions <em>Sub
- * Regions</em>}</li>
- * <li>{@link org.yakindu.sct.model.sgraph.impl.StateImpl#isOrthogonal <em>
- * Orthogonal</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sgraph.impl.StateImpl#getSubRegions <em>Sub Regions</em>}</li>
+ *   <li>{@link org.yakindu.sct.model.sgraph.impl.StateImpl#isOrthogonal <em>Orthogonal</em>}</li>
  * </ul>
  * </p>
- * 
+ *
  * @generated
  */
 public class StateImpl extends AbstractStateImpl implements State {
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
 	 * @generated
 	 */
 	public static final String copyright = "Copyright (c) 2011 committers of YAKINDU and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\nContributors:\r\ncommitters of YAKINDU - initial API and implementation\r\n";
 
 	/**
-	 * The cached value of the '{@link #getSubRegions() <em>Sub Regions</em>}'
-	 * containment reference list. <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
+	 * The cached value of the '{@link #getSubRegions() <em>Sub Regions</em>}' containment reference list.
+	 * <!-- begin-user-doc --> <!-- end-user-doc -->
 	 * @see #getSubRegions()
 	 * @generated
 	 * @ordered
@@ -56,9 +52,8 @@ public class StateImpl extends AbstractStateImpl implements State {
 	protected EList<Region> subRegions;
 
 	/**
-	 * The default value of the '{@link #isOrthogonal() <em>Orthogonal</em>}'
-	 * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
+	 * The default value of the '{@link #isOrthogonal() <em>Orthogonal</em>}' attribute.
+	 * <!-- begin-user-doc --> <!-- end-user-doc -->
 	 * @see #isOrthogonal()
 	 * @generated
 	 * @ordered
@@ -67,7 +62,6 @@ public class StateImpl extends AbstractStateImpl implements State {
 
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
 	 * @generated
 	 */
 	protected StateImpl() {
@@ -76,7 +70,6 @@ public class StateImpl extends AbstractStateImpl implements State {
 
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
 	 * @generated
 	 */
 	@Override
@@ -86,13 +79,11 @@ public class StateImpl extends AbstractStateImpl implements State {
 
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
 	 * @generated
 	 */
 	public EList<Region> getSubRegions() {
 		if (subRegions == null) {
-			subRegions = new EObjectContainmentEList<Region>(Region.class,
-					this, SGraphPackage.STATE__SUB_REGIONS);
+			subRegions = new EObjectContainmentEList<Region>(Region.class, this, SGraphPackage.STATE__SUB_REGIONS);
 		}
 		return subRegions;
 	}
@@ -108,80 +99,74 @@ public class StateImpl extends AbstractStateImpl implements State {
 
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
 	 * @generated
 	 */
 	@Override
 	public NotificationChain eInverseRemove(InternalEObject otherEnd,
 			int featureID, NotificationChain msgs) {
 		switch (featureID) {
-		case SGraphPackage.STATE__SUB_REGIONS:
-			return ((InternalEList<?>) getSubRegions()).basicRemove(otherEnd,
-					msgs);
+			case SGraphPackage.STATE__SUB_REGIONS:
+				return ((InternalEList<?>)getSubRegions()).basicRemove(otherEnd, msgs);
 		}
 		return super.eInverseRemove(otherEnd, featureID, msgs);
 	}
 
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
 	 * @generated
 	 */
 	@Override
 	public Object eGet(int featureID, boolean resolve, boolean coreType) {
 		switch (featureID) {
-		case SGraphPackage.STATE__SUB_REGIONS:
-			return getSubRegions();
-		case SGraphPackage.STATE__ORTHOGONAL:
-			return isOrthogonal();
+			case SGraphPackage.STATE__SUB_REGIONS:
+				return getSubRegions();
+			case SGraphPackage.STATE__ORTHOGONAL:
+				return isOrthogonal();
 		}
 		return super.eGet(featureID, resolve, coreType);
 	}
 
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
 	 * @generated
 	 */
 	@SuppressWarnings("unchecked")
 	@Override
 	public void eSet(int featureID, Object newValue) {
 		switch (featureID) {
-		case SGraphPackage.STATE__SUB_REGIONS:
-			getSubRegions().clear();
-			getSubRegions().addAll((Collection<? extends Region>) newValue);
-			return;
+			case SGraphPackage.STATE__SUB_REGIONS:
+				getSubRegions().clear();
+				getSubRegions().addAll((Collection<? extends Region>)newValue);
+				return;
 		}
 		super.eSet(featureID, newValue);
 	}
 
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
 	 * @generated
 	 */
 	@Override
 	public void eUnset(int featureID) {
 		switch (featureID) {
-		case SGraphPackage.STATE__SUB_REGIONS:
-			getSubRegions().clear();
-			return;
+			case SGraphPackage.STATE__SUB_REGIONS:
+				getSubRegions().clear();
+				return;
 		}
 		super.eUnset(featureID);
 	}
 
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
 	 * @generated
 	 */
 	@Override
 	public boolean eIsSet(int featureID) {
 		switch (featureID) {
-		case SGraphPackage.STATE__SUB_REGIONS:
-			return subRegions != null && !subRegions.isEmpty();
-		case SGraphPackage.STATE__ORTHOGONAL:
-			return isOrthogonal() != ORTHOGONAL_EDEFAULT;
+			case SGraphPackage.STATE__SUB_REGIONS:
+				return subRegions != null && !subRegions.isEmpty();
+			case SGraphPackage.STATE__ORTHOGONAL:
+				return isOrthogonal() != ORTHOGONAL_EDEFAULT;
 		}
 		return super.eIsSet(featureID);
 	}

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

@@ -99,7 +99,7 @@
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="SubmachineState" eSuperTypes="#//AbstractState">
     <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="SubStatechartExists"/>
+      <details key="constraints" value="SubStatechartExists SubStatechartIsNotACycle"/>
     </eAnnotations>
     <eStructuralFeatures xsi:type="ecore:EReference" name="substatechart" eType="#//Statechart"/>
   </eClassifiers>

File diff suppressed because it is too large
+ 232 - 480
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/util/SGraphValidator.java