You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ra...@apache.org on 2005/10/23 20:45:47 UTC

svn commit: r327833 - in /jakarta/commons/sandbox/scxml/trunk/src: main/java/org/apache/commons/scxml/ main/java/org/apache/commons/scxml/model/ test/java/org/apache/commons/scxml/

Author: rahul
Date: Sun Oct 23 11:45:42 2005
New Revision: 327833

URL: http://svn.apache.org/viewcvs?rev=327833&view=rev
Log:
1) Bug fix: SCXMLHelper#getAncestorClosure() overzealous to jump upper bounds for self transitions; correct (simplify) samples accordingly
2) Update xmlns in samples

Modified:
    jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLHelper.java
    jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/model/SCXML.java
    jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-01.xml
    jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-02.xml
    jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/transitions-01.xml

Modified: jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLHelper.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLHelper.java?rev=327833&r1=327832&r2=327833&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLHelper.java (original)
+++ jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLHelper.java Sun Oct 23 11:45:42 2005
@@ -84,15 +84,15 @@
         Set closure = new HashSet(states.size() * 2);
         for (Iterator i = states.iterator(); i.hasNext();) {
             TransitionTarget tt = (TransitionTarget) i.next();
-            closure.add(tt);
-            while ((tt = tt.getParent()) != null) {
-                if (upperBounds != null && upperBounds.contains(tt)) {
+            while (tt != null) {
+                if (!closure.add(tt)) {
+                    //tt is already a part of the closure
                     break;
                 }
-                if (!closure.add(tt)) {
-                    //parent is already a part of the closure
+                if (upperBounds != null && upperBounds.contains(tt)) {
                     break;
                 }
+                tt = tt.getParent();
             }
         }
         return closure;

Modified: jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/model/SCXML.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/model/SCXML.java?rev=327833&r1=327832&r2=327833&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/model/SCXML.java (original)
+++ jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/model/SCXML.java Sun Oct 23 11:45:42 2005
@@ -39,7 +39,7 @@
     /**
      * The SCXML XMLNS.
      */
-    public static final String XMLNS = "http://www.w3.org/2005/01/SCXML";
+    public static final String XMLNS = "http://www.w3.org/2005/07/SCXML";
 
     /**
      * The xmlns attribute on the root <smxml> element.

Modified: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-01.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-01.xml?rev=327833&r1=327832&r2=327833&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-01.xml (original)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-01.xml Sun Oct 23 11:45:42 2005
@@ -14,7 +14,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<scxml xmlns="http://www.w3.org/2005/01/SCXML"
+<scxml xmlns="http://www.w3.org/2005/07/SCXML"
        version="1.0"
        initialstate="off">
   
@@ -39,14 +39,14 @@
       <if cond="${empty cook_time}">
         <!-- default setting -->
         <var name="cook_time" expr="${5}"/>
-        <!-- timer variable -->
-        <var name="timer" expr="${0}"/>
       </if>
       <!-- again, door_closed should be a part of a global context -->
       <if cond="${empty door_closed}">
         <!-- default setting -->
         <var name="door_closed" expr="${true}"/>
       </if>
+      <!-- timer variable -->
+      <var name="timer" expr="${0}"/>
     </onentry>
 
     <transition event="turn_off">
@@ -79,11 +79,6 @@
         <target next="cooking"/>
       </transition>
     </state>
-
-    <onexit>
-      <!-- reset timer -->
-      <assign name="timer" expr="${0}"/>
-    </onexit>
 
   </state>
 

Modified: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-02.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-02.xml?rev=327833&r1=327832&r2=327833&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-02.xml (original)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-02.xml Sun Oct 23 11:45:42 2005
@@ -14,7 +14,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<scxml xmlns="http://www.w3.org/2005/01/SCXML" version="1.0"  
+<scxml xmlns="http://www.w3.org/2005/07/SCXML" version="1.0"  
        initialstate="oven"> 
 
   <!--  trivial microwave oven example -->
@@ -49,9 +49,9 @@
             <if cond="${empty cook_time}">
               <!-- default setting -->
               <var name="cook_time" expr="${5}"/>
-              <!-- timer variable -->
-              <var name="timer" expr="${0}"/>
             </if>
+            <!-- timer variable -->
+            <var name="timer" expr="${0}"/>
           </onentry>
           
           <transition event="turn_off">
@@ -77,11 +77,6 @@
               <target next="cooking"/>
             </transition>
           </state>
-
-          <onexit>
-            <!-- reset timer -->
-            <assign name="timer" expr="${0}"/>
-          </onexit>
         </state>
       </state>
 

Modified: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/transitions-01.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/transitions-01.xml?rev=327833&r1=327832&r2=327833&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/transitions-01.xml (original)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/transitions-01.xml Sun Oct 23 11:45:42 2005
@@ -14,7 +14,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<scxml xmlns="http://www.w3.org/2005/01/SCXML"
+<scxml xmlns="http://www.w3.org/2005/07/SCXML"
        version="1.0"
        initialstate="ten">
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org