commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1581653 - in /commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2: ./ io/ model/ semantics/
Date Wed, 26 Mar 2014 02:49:33 GMT
Author: ate
Date: Wed Mar 26 02:49:32 2014
New Revision: 1581653

URL: http://svn.apache.org/r1581653
Log:
SCXML-200: more fine-grained type-checking on the SCXML model elements

Modified:
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/Step.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/io/SCXMLReader.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Executable.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Final.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Finalize.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/History.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/OnEntry.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/OnExit.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Parallel.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/SimpleTransition.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/State.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/TransitionTarget.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/TransitionalState.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/Step.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/Step.java?rev=1581653&r1=1581652&r2=1581653&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/Step.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/Step.java Wed Mar 26
02:49:32 2014
@@ -18,10 +18,12 @@ package org.apache.commons.scxml2;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.commons.scxml2.model.EnterableState;
-import org.apache.commons.scxml2.model.Transition;
+import org.apache.commons.scxml2.model.SimpleTransition;
 
 /**
  * A logical unit of progression in the execution of a SCXML model.
@@ -58,10 +60,12 @@ public class Step {
      * The list of TransitionTargets that were entered during this step by default
      */
     private List<EnterableState> defaultEntryList;
+
+    private Map<String, SimpleTransition> defaultHistoryTransitionEntryMap;
     /**
      * The list of Transitions taken during this step.
      */
-    private List<Transition> transitList;
+    private List<SimpleTransition> transitList;
 
     /**
      * Constructor.
@@ -90,7 +94,8 @@ public class Step {
         this.exitList = new ArrayList<EnterableState>();
         this.entryList = new ArrayList<EnterableState>();
         this.defaultEntryList = new ArrayList<EnterableState>();
-        this.transitList = new ArrayList<Transition>();
+        this.defaultHistoryTransitionEntryMap = new HashMap<String, SimpleTransition>();
+        this.transitList = new ArrayList<SimpleTransition>();
     }
 
     /**
@@ -136,6 +141,13 @@ public class Step {
     }
 
     /**
+     * @return Returns the defaultHistoryTransitionEntryMap.
+     */
+    public Map<String, SimpleTransition> getDefaultHistoryTransitionEntryMap() {
+        return defaultHistoryTransitionEntryMap;
+    }
+
+    /**
      * @return Returns the exitList.
      */
     public List<EnterableState> getExitList() {
@@ -152,7 +164,7 @@ public class Step {
     /**
      * @return Returns the transitList.
      */
-    public List<Transition> getTransitList() {
+    public List<SimpleTransition> getTransitList() {
         return transitList;
     }
 

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/io/SCXMLReader.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/io/SCXMLReader.java?rev=1581653&r1=1581652&r2=1581653&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/io/SCXMLReader.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/io/SCXMLReader.java
Wed Mar 26 02:49:32 2014
@@ -696,8 +696,11 @@ public final class SCXMLReader {
 
         if (parent == null) {
             scxml.addChild(state);
-        } else {
-            parent.addChild(state);
+        } else if (parent instanceof State) {
+            ((State)parent).addChild(state);
+        }
+        else {
+            ((Parallel)parent).addChild(state);
         }
         scxml.addTarget(state);
         if (configuration.parent != null) {
@@ -787,8 +790,11 @@ public final class SCXMLReader {
 
         if (parent == null) {
             scxml.addChild(parallel);
-        } else {
-            parent.addChild(parallel);
+        } else if (parent instanceof State) {
+            ((State)parent).addChild(parallel);
+        }
+        else {
+            ((Parallel)parent).addChild(parallel);
         }
         scxml.addTarget(parallel);
         if (configuration.parent != null) {

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Executable.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Executable.java?rev=1581653&r1=1581652&r2=1581653&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Executable.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Executable.java
Wed Mar 26 02:49:32 2014
@@ -36,7 +36,7 @@ public abstract class Executable impleme
     /**
      * The parent container, for traceability.
      */
-    private TransitionTarget parent;
+    private EnterableState parent;
 
     /**
      * Constructor.
@@ -68,20 +68,20 @@ public abstract class Executable impleme
     }
 
     /**
-     * Get the TransitionTarget parent.
+     * Get the EnterableState parent.
      *
      * @return Returns the parent.
      */
-    public final TransitionTarget getParent() {
+    public EnterableState getParent() {
         return parent;
     }
 
     /**
-     * Set the TransitionTarget parent.
+     * Set the EnterableState parent.
      *
      * @param parent The parent to set.
      */
-    public final void setParent(final TransitionTarget parent) {
+    protected void setParent(final EnterableState parent) {
         this.parent = parent;
     }
 }

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Final.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Final.java?rev=1581653&r1=1581652&r2=1581653&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Final.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Final.java Wed
Mar 26 02:49:32 2014
@@ -36,5 +36,20 @@ public class Final extends EnterableStat
         super();
     }
 
+    /**
+     * @return Returns the State parent
+     */
+    @Override
+    public State getParent() {
+        return (State)super.getParent();
+    }
+
+    /**
+     * Set the parent State.
+     * @param parent The parent state to set
+     */
+    public final void setParent(State parent) {
+        super.setParent(parent);
+    }
 }
 

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Finalize.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Finalize.java?rev=1581653&r1=1581652&r2=1581653&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Finalize.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Finalize.java
Wed Mar 26 02:49:32 2014
@@ -35,5 +35,21 @@ public class Finalize extends Executable
         super();
     }
 
+    /**
+     * @return Returns the TransitionalState parent
+     */
+    @Override
+    public TransitionalState getParent() {
+        return (TransitionalState)super.getParent();
+    }
+
+    /**
+     * Set the TransitionalState parent.
+     *
+     * @param parent The parent to set.
+     */
+    public final void setParent(final TransitionalState parent) {
+        super.setParent(parent);
+    }
 }
 

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/History.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/History.java?rev=1581653&r1=1581652&r2=1581653&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/History.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/History.java
Wed Mar 26 02:49:32 2014
@@ -62,8 +62,11 @@ public class History extends TransitionT
      * @param transition The transition to set.
      */
     public final void setTransition(final SimpleTransition transition) {
+        if (getParent() == null) {
+            throw new IllegalStateException("History transition cannot be set before setting
its parent");
+        }
         this.transition = transition;
-        this.transition.setParent(this);
+        this.transition.setParent(getParent());
     }
 
     /**
@@ -86,16 +89,21 @@ public class History extends TransitionT
         //shallow is by default
     }
 
+    /**
+     * @return Returns the TransitionalState parent
+     */
     @Override
     public TransitionalState getParent() {
         return (TransitionalState)super.getParent();
     }
 
-    @Override
-    public void setParent(final EnterableState parent) {
-        // enforce / validate only TransitionalState parents are allowed
-        TransitionalState ts = (TransitionalState)parent;
-        super.setParent(ts);
+    /**
+     * Set the TransitionalState parent.
+     *
+     * @param parent The parent to set.
+     */
+    public final void setParent(final TransitionalState parent) {
+        super.setParent(parent);
     }
 }
 

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/OnEntry.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/OnEntry.java?rev=1581653&r1=1581652&r2=1581653&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/OnEntry.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/OnEntry.java
Wed Mar 26 02:49:32 2014
@@ -36,5 +36,15 @@ public class OnEntry extends Executable 
     public OnEntry() {
         super();
     }
+
+    /**
+     * Set the EnterableState parent.
+     *
+     * @param parent The parent to set.
+     */
+    @Override
+    public final void setParent(final EnterableState parent) {
+        super.setParent(parent);
+    }
 }
 

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/OnExit.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/OnExit.java?rev=1581653&r1=1581652&r2=1581653&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/OnExit.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/OnExit.java Wed
Mar 26 02:49:32 2014
@@ -36,5 +36,15 @@ public class OnExit extends Executable {
     public OnExit() {
         super();
     }
+
+    /**
+     * Set the EnterableState parent.
+     *
+     * @param parent The parent to set.
+     */
+    @Override
+    public final void setParent(final EnterableState parent) {
+        super.setParent(parent);
+    }
 }
 

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Parallel.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Parallel.java?rev=1581653&r1=1581652&r2=1581653&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Parallel.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Parallel.java
Wed Mar 26 02:49:32 2014
@@ -38,10 +38,11 @@ public class Parallel extends Transition
     public Parallel() {
     }
 
-    @Override
-    public void addChild(final EnterableState es) {
-        // enforce/validate only TransitionalState children are allowed
-        TransitionalState ts = (TransitionalState)es;
+    /**
+     * Add a TransitionalState (State or Parallel) child
+     * @param ts the child to add
+     */
+    public final void addChild(final TransitionalState ts) {
         super.addChild(ts);
     }
 }

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/SimpleTransition.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/SimpleTransition.java?rev=1581653&r1=1581652&r2=1581653&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/SimpleTransition.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/SimpleTransition.java
Wed Mar 26 02:49:32 2014
@@ -17,6 +17,7 @@
 package org.apache.commons.scxml2.model;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
@@ -29,6 +30,8 @@ import java.util.Map;
 public class SimpleTransition extends Executable
         implements NamespacePrefixesHolder, Observable {
 
+    private static final State SCXML_TRANSITION_DOMAIN = new State(){};
+
     /**
      * Serial version UID.
      */
@@ -41,6 +44,24 @@ public class SimpleTransition extends Ex
     private TransitionType type;
 
     /**
+     * The transition parent itself, or a compound state parent, or null
+     * <p>
+     * If the transition has no targets, its TransitionalState (State or Parallel) parent
represents its own transition
+     * domain.
+     * </p>
+     * <p>
+     * If the transition has targets then the transition domain is the compound State parent
such that:
+     * <ul>
+     *   <li>all states that are exited or entered as a result of taking this transition
are descendants of it</li>
+     *   <li>no descendant of it has this property</li>
+     * </ul>
+     * If there is no such compound State parent, the transition domain effectively becomes
the SCXML document itself,
+     * which is indicated by a null (empty) transitionDomain.
+     * </p>
+     */
+    private TransitionalState transitionDomain;
+
+    /**
      * Derived effective Transition type.
      * @see #isTypeInternal()
      */
@@ -81,6 +102,32 @@ public class SimpleTransition extends Ex
         this.paths = new ArrayList<Path>();
     }
 
+    private boolean isCompoundStateParent(TransitionalState ts) {
+        return ts != null && ts instanceof State && ((State)ts).isComposite();
+    }
+
+    /**
+     * Get the TransitionalState (State or Parallel) parent.
+     *
+     * @return Returns the parent.
+     */
+    @Override
+    public TransitionalState getParent() {
+        return (TransitionalState)super.getParent();
+    }
+
+    /**
+     * Set the TransitionalState (State or Parallel) parent
+     * <p>
+     * For transitions of Initial or History elements their TransitionalState parent must
be set.
+     * </p>
+     *
+     * @param parent The parent to set.
+     */
+    public final void setParent(final TransitionalState parent) {
+        super.setParent(parent);
+    }
+
     /**
      * @return true if Transition type == internal or false if type == external (default)
      */
@@ -114,32 +161,88 @@ public class SimpleTransition extends Ex
      */
     public final boolean isTypeInternal() {
         if (typeInternal == null) {
-            // derive typeInternal
 
-            boolean internal = TransitionType.internal == type;
-
-            if (internal) {
-                internal = (getParent() != null && getParent() instanceof State &&
((State)getParent()).isComposite());
-            }
+            // derive typeInternal
+            typeInternal = TransitionType.internal == type && isCompoundStateParent(getParent());
 
-            if (internal && targets.size() > 0) {
+            if (typeInternal && targets.size() > 0) {
                 for (Path p : getPaths()) {
                     // TODO: testing the following actual works and always is correct
                     if (p.getPathScope() == null || p.getPathScope() == getParent()) {
                         continue;
                     }
                     // not a proper descendant
-                    internal = false;
+                    typeInternal = false;
                     break;
                 }
             }
-
-            typeInternal = internal;
         }
         return typeInternal;
     }
 
     /**
+     * Returns the transition domain of this transition
+     * <p>
+     * The returned transition domain is either the transition parent itself, or a compound
state parent, or null
+     * </p>
+     * <p>
+     * If the transition has no targets, its TransitionalState (State or Parallel) parent
represents its own transition
+     * domain.
+     * </p>
+     * <p>
+     * If the transition has targets then the transition domain is the compound State parent
such that:
+     * <ul>
+     *   <li>all states that are exited or entered as a result of taking this transition
are descendants of it</li>
+     *   <li>no descendant of it has this property</li>
+     * </ul>
+     * If there is no such compound State parent, the transition domain effectively becomes
the SCXML document itself,
+     * which is indicated by a null (empty) transitionDomain.
+     * </p>
+     *
+     * @return The transition domain of this transition
+     */
+    public TransitionalState getTransitionDomain() {
+        if (transitionDomain == null) {
+
+            if (getParent() == null) {
+                transitionDomain = SCXML_TRANSITION_DOMAIN;
+            }
+            else {
+                if (targets.size() == 0 || isTypeInternal()) {
+                    transitionDomain = getParent();
+                }
+                else {
+                    // findLCCA
+                    for (int i = getParent().getNumberOfAncestors()-1; i > -1; i--) {
+                        if (isCompoundStateParent(getParent().getAncestor(i))) {
+                            boolean allDescendants = true;
+                            for (TransitionTarget tt : targets) {
+                                if (i > tt.getNumberOfAncestors()) {
+                                    i = tt.getNumberOfAncestors();
+                                    allDescendants = false;
+                                    break;
+                                }
+                                if (tt.getAncestor(i) != getParent().getAncestor(i)) {
+                                    allDescendants = false;
+                                    break;
+                                }
+                            }
+                            if (allDescendants) {
+                                transitionDomain = getParent().getAncestor(i);
+                                break;
+                            }
+                        }
+                    }
+                }
+                if (transitionDomain == null) {
+                    transitionDomain = SCXML_TRANSITION_DOMAIN;
+                }
+            }
+        }
+        return transitionDomain == SCXML_TRANSITION_DOMAIN ? null : transitionDomain;
+    }
+
+    /**
      * Get the XML namespaces at this action node in the SCXML document.
      *
      * @return Returns the map of namespaces.

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/State.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/State.java?rev=1581653&r1=1581652&r2=1581653&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/State.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/State.java Wed
Mar 26 02:49:32 2014
@@ -120,5 +120,14 @@ public class State extends TransitionalS
     public final boolean isRegion() {
         return getParent() instanceof  Parallel;
     }
+
+    /**
+     * Adds an EnterableState (State, Final or Parallel) child
+     * @param es the child to add
+     */
+    @Override
+    public final void addChild(final EnterableState es) {
+        super.addChild(es);
+    }
 }
 

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/TransitionTarget.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/TransitionTarget.java?rev=1581653&r1=1581652&r2=1581653&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/TransitionTarget.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/TransitionTarget.java
Wed Mar 26 02:49:32 2014
@@ -78,7 +78,7 @@ public abstract class TransitionTarget i
      * @param level the level of the ancestor to return, zero being top
      * @return the ancestor at specified level
      */
-    public final EnterableState getAncestor(int level) {
+    public EnterableState getAncestor(int level) {
         return ancestors[level];
     }
 
@@ -101,7 +101,7 @@ public abstract class TransitionTarget i
      *
      * @param parent The parent state to set
      */
-    public void setParent(final EnterableState parent) {
+    protected void setParent(final EnterableState parent) {
         if (parent == null) {
             throw new IllegalArgumentException("Parent parameter cannot be null");
         }

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/TransitionalState.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/TransitionalState.java?rev=1581653&r1=1581652&r2=1581653&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/TransitionalState.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/TransitionalState.java
Wed Mar 26 02:49:32 2014
@@ -77,6 +77,35 @@ public abstract class TransitionalState 
     }
 
     /**
+     * Get the TransitionalState (State or Parallel) parent.
+     *
+     * @return Returns the parent.
+     */
+    @Override
+    public TransitionalState getParent() {
+        return (TransitionalState)super.getParent();
+    }
+
+    /**
+     * Set the TransitionalState parent
+     *
+     * @param parent The parent to set.
+     */
+    public final void setParent(final TransitionalState parent) {
+        super.setParent(parent);
+    }
+
+    /**
+     * Get the ancestor of this TransitionalState at specified level
+     * @param level the level of the ancestor to return, zero being top
+     * @return the ancestor at specified level
+     */
+    @Override
+    public TransitionalState getAncestor(int level) {
+        return (TransitionalState)super.getAncestor(level);
+    }
+
+    /**
      * Get the list of all outgoing transitions from this state, that
      * will be candidates for being fired on the given event.
      *
@@ -208,7 +237,7 @@ public abstract class TransitionalState 
      *
      * @since 0.7
      */
-    public void addChild(final EnterableState es) {
+    protected void addChild(final EnterableState es) {
         children.add(es);
         es.setParent(this);
     }

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java?rev=1581653&r1=1581652&r2=1581653&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java
Wed Mar 26 02:49:32 2014
@@ -248,12 +248,14 @@ public class SCXMLSemanticsImpl implemen
                                          final ErrorReporter errRep, final SCInstance scInstance)
throws ModelException {
         NotificationRegistry nr = scInstance.getNotificationRegistry();
         Collection<TriggerEvent> internalEvents = step.getAfterStatus().getEvents();
-        for (Transition t : step.getTransitList()) {
-            executeContent(t, evtDispatcher, errRep, scInstance, internalEvents);
-            List<TransitionTarget> rtargets = t.getRuntimeTargets();
-            for (TransitionTarget tt : rtargets) {
-                nr.fireOnTransition(t, t.getParent(), tt, t);
-                nr.fireOnTransition(stateMachine, t.getParent(), tt, t);
+        for (SimpleTransition st : step.getTransitList()) {
+            executeContent(st, evtDispatcher, errRep, scInstance, internalEvents);
+            if (st instanceof Transition) {
+                Transition t = (Transition)st;
+                for (TransitionTarget tt : st.getRuntimeTargets()) {
+                    nr.fireOnTransition(st, st.getParent(), tt, t);
+                    nr.fireOnTransition(stateMachine, t.getParent(), tt, t);
+                }
             }
         }
     }
@@ -445,9 +447,16 @@ public class SCXMLSemanticsImpl implemen
             }
         }
         //remove list (filtered-out list)
-        List<Transition> removeList = new LinkedList<Transition>();
+        List<SimpleTransition> removeList = new LinkedList<SimpleTransition>();
         //iterate over non-filtered transition set
-        for (Transition t : step.getTransitList()) {
+        for (SimpleTransition st : step.getTransitList()) {
+            Transition t;
+            if (st instanceof SimpleTransition) {
+                t = (Transition)st;
+            }
+            else {
+                continue;
+            }
             // event check
             String event = t.getEvent();
             if (!eventMatch(event, allEvents)) {
@@ -555,10 +564,10 @@ public class SCXMLSemanticsImpl implemen
      * @return Set The target set
      */
     public Set<TransitionTarget> seedTargetSet(final Set<EnterableState> residual,
-            final List<Transition> transitList, final ErrorReporter errRep) {
+            final List<SimpleTransition> transitList, final ErrorReporter errRep) {
         Set<TransitionTarget> seedSet = new HashSet<TransitionTarget>();
         Set<EnterableState> regions = new HashSet<EnterableState>();
-        for (Transition t : transitList) {
+        for (SimpleTransition t : transitList) {
             //iterate over transitions and add target states
             if (t.getTargets().size() > 0) {
                 seedSet.addAll(t.getTargets());
@@ -693,11 +702,13 @@ public class SCXMLSemanticsImpl implemen
             final ErrorReporter errorReporter, final SCInstance scInstance)
     throws ModelException {
         Set<EnterableState> currentStates = step.getBeforeStatus().getStates();
-        List<Transition> transitions = step.getTransitList();
+        List<SimpleTransition> transitions = step.getTransitList();
         // DetermineExitedStates (currentStates, transitList) -> exitedStates
         Set<TransitionTarget> exitedStates = new HashSet<TransitionTarget>();
-        for (Transition t : transitions) {
-            exitedStates.addAll(SCXMLHelper.getStatesExited(t, currentStates));
+        for (SimpleTransition st : transitions) {
+            if (st instanceof Transition) {
+                exitedStates.addAll(SCXMLHelper.getStatesExited((Transition)st, currentStates));
+            }
         }
         // compute residual states - these are preserved from the previous step
         Set<EnterableState> residual = new HashSet<EnterableState>(currentStates);
@@ -710,7 +721,7 @@ public class SCXMLSemanticsImpl implemen
         // BuildOnEntryList (targetSet, seedSet) -> entryList
         Set<EnterableState> entered = SCXMLHelper.getAncestorClosure(targetSet, seedSet);
         seedSet.clear();
-        for (Transition t : transitions) {
+        for (SimpleTransition t : transitions) {
             List<Path> paths = t.getPaths();
             for (Path p : paths) {
                 for (TransitionTarget tt : p.getDownwardSegment()) {



Mime
View raw message