Author: guixl
Date: Sun May 30 02:46:14 2010
New Revision: 949461

URL: http://svn.apache.org/viewvc?rev=949461&view=rev
Log:
amend data model : State has 0 or more sub States

Modified:
    
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/model/scxml.ecore
    
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/ModelingPackage.java
    
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/State.java
    
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/impl/ModelingPackageImpl.java
    
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/impl/StateImpl.java

Modified: 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/model/scxml.ecore
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/model/scxml.ecore?rev=949461&r1=949460&r2=949461&view=diff
==============================================================================
--- 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/model/scxml.ecore
 (original)
+++ 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/model/scxml.ecore
 Sun May 30 02:46:14 2010
@@ -20,8 +20,8 @@
         containment="true"/>
     <eStructuralFeatures xsi:type="ecore:EReference" name="initState" 
eType="#//InitialState"
         containment="true"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="subState" 
eType="#//State"
-        containment="true"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="subState" 
upperBound="-1"
+        eType="#//State" containment="true"/>
     <eStructuralFeatures xsi:type="ecore:EReference" name="finalState" 
upperBound="-1"
         eType="#//FinalState" containment="true"/>
     <eStructuralFeatures xsi:type="ecore:EReference" name="subParallel" 
upperBound="-1"

Modified: 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/ModelingPackage.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/ModelingPackage.java?rev=949461&r1=949460&r2=949461&view=diff
==============================================================================
--- 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/ModelingPackage.java
 (original)
+++ 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/ModelingPackage.java
 Sun May 30 02:46:14 2010
@@ -200,7 +200,7 @@ public interface ModelingPackage extends
        int STATE__INIT_STATE = NAMED_ELEMENT_FEATURE_COUNT + 4;
 
        /**
-        * The feature id for the '<em><b>Sub State</b></em>' containment 
reference.
+        * The feature id for the '<em><b>Sub State</b></em>' containment 
reference list.
         * <!-- begin-user-doc -->
         * <!-- end-user-doc -->
         * @generated
@@ -1831,10 +1831,10 @@ public interface ModelingPackage extends
        EReference getState_InitState();
 
        /**
-        * Returns the meta object for the containment reference '{...@link 
org.apache.commons.scxml.modeling.State#getSubState <em>Sub State</em>}'.
+        * Returns the meta object for the containment reference list 
'{...@link org.apache.commons.scxml.modeling.State#getSubState <em>Sub 
State</em>}'.
         * <!-- begin-user-doc -->
         * <!-- end-user-doc -->
-        * @return the meta object for the containment reference '<em>Sub 
State</em>'.
+        * @return the meta object for the containment reference list '<em>Sub 
State</em>'.
         * @see org.apache.commons.scxml.modeling.State#getSubState()
         * @see #getState()
         * @generated
@@ -3284,7 +3284,7 @@ public interface ModelingPackage extends
                EReference STATE__INIT_STATE = eINSTANCE.getState_InitState();
 
                /**
-                * The meta object literal for the '<em><b>Sub State</b></em>' 
containment reference feature.
+                * The meta object literal for the '<em><b>Sub State</b></em>' 
containment reference list feature.
                 * <!-- begin-user-doc -->
                 * <!-- end-user-doc -->
                 * @generated

Modified: 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/State.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/State.java?rev=949461&r1=949460&r2=949461&view=diff
==============================================================================
--- 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/State.java
 (original)
+++ 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/State.java
 Sun May 30 02:46:14 2010
@@ -178,30 +178,20 @@ public interface State extends NamedElem
        void setInitState(InitialState value);
 
        /**
-        * Returns the value of the '<em><b>Sub State</b></em>' containment 
reference.
+        * Returns the value of the '<em><b>Sub State</b></em>' containment 
reference list.
+        * The list contents are of type {...@link 
org.apache.commons.scxml.modeling.State}.
         * <!-- begin-user-doc -->
         * <p>
         * If the meaning of the '<em>Sub State</em>' containment reference 
isn't clear,
         * there really should be more of a description here...
         * </p>
         * <!-- end-user-doc -->
-        * @return the value of the '<em>Sub State</em>' containment reference.
-        * @see #setSubState(State)
+        * @return the value of the '<em>Sub State</em>' containment reference 
list.
         * @see 
org.apache.commons.scxml.modeling.ModelingPackage#getState_SubState()
-        * @model containment="true"
-        * @generated
-        */
-       State getSubState();
-
-       /**
-        * Sets the value of the '{...@link 
org.apache.commons.scxml.modeling.State#getSubState <em>Sub State</em>}' 
containment reference.
-        * <!-- begin-user-doc -->
-        * <!-- end-user-doc -->
-        * @param value the new value of the '<em>Sub State</em>' containment 
reference.
-        * @see #getSubState()
+        * @model type="org.apache.commons.scxml.modeling.State" 
containment="true"
         * @generated
         */
-       void setSubState(State value);
+       EList getSubState();
 
        /**
         * Returns the value of the '<em><b>Final State</b></em>' containment 
reference list.

Modified: 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/impl/ModelingPackageImpl.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/impl/ModelingPackageImpl.java?rev=949461&r1=949460&r2=949461&view=diff
==============================================================================
--- 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/impl/ModelingPackageImpl.java
 (original)
+++ 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/impl/ModelingPackageImpl.java
 Sun May 30 02:46:14 2010
@@ -1805,7 +1805,7 @@ public class ModelingPackageImpl extends
                initEReference(getState_OnEntry(), this.getOnEntry(), null, 
"onEntry", null, 0, 1, State.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, 
IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, 
IS_ORDERED);
                initEReference(getState_OnExit(), this.getOnExit(), null, 
"onExit", null, 0, 1, State.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, 
IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, 
IS_ORDERED);
                initEReference(getState_InitState(), this.getInitialState(), 
null, "initState", null, 0, 1, State.class, !IS_TRANSIENT, !IS_VOLATILE, 
IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, 
!IS_DERIVED, IS_ORDERED);
-               initEReference(getState_SubState(), this.getState(), null, 
"subState", null, 0, 1, State.class, !IS_TRANSIENT, !IS_VOLATILE, 
IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, 
!IS_DERIVED, IS_ORDERED);
+               initEReference(getState_SubState(), this.getState(), null, 
"subState", null, 0, -1, State.class, !IS_TRANSIENT, !IS_VOLATILE, 
IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, 
!IS_DERIVED, IS_ORDERED);
                initEReference(getState_FinalState(), this.getFinalState(), 
null, "finalState", null, 0, -1, State.class, !IS_TRANSIENT, !IS_VOLATILE, 
IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, 
!IS_DERIVED, IS_ORDERED);
                initEReference(getState_SubParallel(), this.getParallel(), 
null, "subParallel", null, 0, -1, State.class, !IS_TRANSIENT, !IS_VOLATILE, 
IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, 
!IS_DERIVED, IS_ORDERED);
                initEReference(getState_HistoryState(), this.getHistoryState(), 
null, "historyState", null, 0, -1, State.class, !IS_TRANSIENT, !IS_VOLATILE, 
IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, 
!IS_DERIVED, IS_ORDERED);

Modified: 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/impl/StateImpl.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/impl/StateImpl.java?rev=949461&r1=949460&r2=949461&view=diff
==============================================================================
--- 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/impl/StateImpl.java
 (original)
+++ 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling/src/org/apache/commons/scxml/modeling/impl/StateImpl.java
 Sun May 30 02:46:14 2010
@@ -139,14 +139,14 @@ public class StateImpl extends NamedElem
        protected InitialState initState;
 
        /**
-        * The cached value of the '{...@link #getSubState() <em>Sub 
State</em>}' containment reference.
+        * The cached value of the '{...@link #getSubState() <em>Sub 
State</em>}' containment reference list.
         * <!-- begin-user-doc -->
         * <!-- end-user-doc -->
         * @see #getSubState()
         * @generated
         * @ordered
         */
-       protected State subState;
+       protected EList subState;
 
        /**
         * The cached value of the '{...@link #getFinalState() <em>Final 
State</em>}' containment reference list.
@@ -392,42 +392,11 @@ public class StateImpl extends NamedElem
         * <!-- end-user-doc -->
         * @generated
         */
-       public State getSubState() {
-               return subState;
-       }
-
-       /**
-        * <!-- begin-user-doc -->
-        * <!-- end-user-doc -->
-        * @generated
-        */
-       public NotificationChain basicSetSubState(State newSubState, 
NotificationChain msgs) {
-               State oldSubState = subState;
-               subState = newSubState;
-               if (eNotificationRequired()) {
-                       ENotificationImpl notification = new 
ENotificationImpl(this, Notification.SET, ModelingPackage.STATE__SUB_STATE, 
oldSubState, newSubState);
-                       if (msgs == null) msgs = notification; else 
msgs.add(notification);
+       public EList getSubState() {
+               if (subState == null) {
+                       subState = new EObjectContainmentEList(State.class, 
this, ModelingPackage.STATE__SUB_STATE);
                }
-               return msgs;
-       }
-
-       /**
-        * <!-- begin-user-doc -->
-        * <!-- end-user-doc -->
-        * @generated
-        */
-       public void setSubState(State newSubState) {
-               if (newSubState != subState) {
-                       NotificationChain msgs = null;
-                       if (subState != null)
-                               msgs = 
((InternalEObject)subState).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - 
ModelingPackage.STATE__SUB_STATE, null, msgs);
-                       if (newSubState != null)
-                               msgs = 
((InternalEObject)newSubState).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - 
ModelingPackage.STATE__SUB_STATE, null, msgs);
-                       msgs = basicSetSubState(newSubState, msgs);
-                       if (msgs != null) msgs.dispatch();
-               }
-               else if (eNotificationRequired())
-                       eNotify(new ENotificationImpl(this, Notification.SET, 
ModelingPackage.STATE__SUB_STATE, newSubState, newSubState));
+               return subState;
        }
 
        /**
@@ -535,7 +504,7 @@ public class StateImpl extends NamedElem
                        case ModelingPackage.STATE__INIT_STATE:
                                return basicSetInitState(null, msgs);
                        case ModelingPackage.STATE__SUB_STATE:
-                               return basicSetSubState(null, msgs);
+                               return 
((InternalEList)getSubState()).basicRemove(otherEnd, msgs);
                        case ModelingPackage.STATE__FINAL_STATE:
                                return 
((InternalEList)getFinalState()).basicRemove(otherEnd, msgs);
                        case ModelingPackage.STATE__SUB_PARALLEL:
@@ -606,7 +575,8 @@ public class StateImpl extends NamedElem
                                setInitState((InitialState)newValue);
                                return;
                        case ModelingPackage.STATE__SUB_STATE:
-                               setSubState((State)newValue);
+                               getSubState().clear();
+                               getSubState().addAll((Collection)newValue);
                                return;
                        case ModelingPackage.STATE__FINAL_STATE:
                                getFinalState().clear();
@@ -654,7 +624,7 @@ public class StateImpl extends NamedElem
                                setInitState((InitialState)null);
                                return;
                        case ModelingPackage.STATE__SUB_STATE:
-                               setSubState((State)null);
+                               getSubState().clear();
                                return;
                        case ModelingPackage.STATE__FINAL_STATE:
                                getFinalState().clear();
@@ -693,7 +663,7 @@ public class StateImpl extends NamedElem
                        case ModelingPackage.STATE__INIT_STATE:
                                return initState != null;
                        case ModelingPackage.STATE__SUB_STATE:
-                               return subState != null;
+                               return subState != null && !subState.isEmpty();
                        case ModelingPackage.STATE__FINAL_STATE:
                                return finalState != null && 
!finalState.isEmpty();
                        case ModelingPackage.STATE__SUB_PARALLEL:


Reply via email to