commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r374978 - in /jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml: SCXMLExecutor.java SCXMLSemantics.java semantics/SCXMLSemanticsImpl.java
Date Sun, 05 Feb 2006 07:29:34 GMT
Author: rahul
Date: Sat Feb  4 23:29:32 2006
New Revision: 374978

URL: http://svn.apache.org/viewcvs?rev=374978&view=rev
Log:
Registry was renamed to SCInstance.


Modified:
    jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/SCXMLExecutor.java
    jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/SCXMLSemantics.java
    jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/semantics/SCXMLSemanticsImpl.java

Modified: jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/SCXMLExecutor.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/SCXMLExecutor.java?rev=374978&r1=374977&r2=374978&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/SCXMLExecutor.java
(original)
+++ jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/SCXMLExecutor.java
Sat Feb  4 23:29:32 2006
@@ -79,9 +79,9 @@
     private SCXMLSemantics semantics;
 
     /**
-     * The Registry.
+     * The SCInstance.
      */
-    private Registry registry;
+    private SCInstance scInstance;
 
     /**
      * The worker method.
@@ -103,14 +103,14 @@
             semantics.enumerateReachableTransitions(stateMachine, step,
                     errorReporter);
             // FilterTransitionSet
-            semantics.filterTransitionsSet(step, errorReporter, registry);
+            semantics.filterTransitionsSet(step, errorReporter, scInstance);
             // FollowTransitions
-            semantics.followTransitions(step, errorReporter, registry);
+            semantics.followTransitions(step, errorReporter, scInstance);
             // UpdateHistoryStates
-            semantics.updateHistoryStates(step, errorReporter, registry);
+            semantics.updateHistoryStates(step, errorReporter, scInstance);
             // ExecuteActions
             semantics.executeActions(step, stateMachine, eventdispatcher,
-                    errorReporter, registry);
+                    errorReporter, scInstance);
             // AssignCurrentStatus
             updateStatus(step);
             // ***Cleanup external events if superStep
@@ -163,8 +163,8 @@
         }
         this.currentStatus = null;
         this.stateMachine = null;
-        this.registry = new Registry();
-        this.registry.setEvaluator(expEvaluator);
+        this.scInstance = new SCInstance();
+        this.scInstance.setEvaluator(expEvaluator);
     }
 
     /**
@@ -176,18 +176,18 @@
      */
     public void reset() throws ModelException {
         // Reset all variable contexts
-        registry.getRootContext().reset();
+        scInstance.getRootContext().reset();
         // all states and parallels, only states have variable contexts
         for (Iterator i = stateMachine.getTargets().values().iterator();
                 i.hasNext();) {
             TransitionTarget tt = (TransitionTarget) i.next();
             if (tt instanceof State) {
-                Context context = registry.lookupContext(tt);
+                Context context = scInstance.lookupContext(tt);
                 if (context != null) {
                     context.reset();
                 }
             } else if (tt instanceof History) {
-                registry.reset((History) tt);
+                scInstance.reset((History) tt);
             }
         }
         // CreateEmptyStatus
@@ -196,10 +196,10 @@
         // DetermineInitialStates
         semantics.determineInitialStates(stateMachine,
                 step.getAfterStatus().getStates(),
-                step.getEntryList(), errorReporter, registry);
+                step.getEntryList(), errorReporter, scInstance);
         // ExecuteActions
         semantics.executeActions(step, stateMachine, eventdispatcher,
-                errorReporter, registry);
+                errorReporter, scInstance);
         // AssignCurrentStatus
         updateStatus(step);
         // Execute Immediate Transitions
@@ -223,14 +223,14 @@
      * @param evaluator The evaluator to set.
      */
     public void setEvaluator(final Evaluator evaluator) {
-        this.registry.setEvaluator(evaluator);
+        this.scInstance.setEvaluator(evaluator);
     }
 
     /**
      * @param rootContext The Context that ties to the host environment.
      */
     public void setRootContext(final Context rootContext) {
-        this.registry.setRootContext(rootContext);
+        this.scInstance.setRootContext(rootContext);
     }
 
     /**
@@ -336,7 +336,7 @@
      */
     public void addListener(final SCXML scxml, final SCXMLListener listener) {
         Object observable = scxml;
-        registry.getNotificationRegistry().addListener(observable, listener);
+        scInstance.getNotificationRegistry().addListener(observable, listener);
     }
 
     /**
@@ -348,7 +348,8 @@
     public void removeListener(final SCXML scxml,
             final SCXMLListener listener) {
         Object observable = scxml;
-        registry.getNotificationRegistry().removeListener(observable, listener);
+        scInstance.getNotificationRegistry().removeListener(observable,
+            listener);
     }
 
     /**
@@ -361,7 +362,7 @@
     public void addListener(final TransitionTarget transitionTarget,
             final SCXMLListener listener) {
         Object observable = transitionTarget;
-        registry.getNotificationRegistry().addListener(observable, listener);
+        scInstance.getNotificationRegistry().addListener(observable, listener);
     }
 
     /**
@@ -373,7 +374,7 @@
     public void removeListener(final TransitionTarget transitionTarget,
             final SCXMLListener listener) {
         Object observable = transitionTarget;
-        registry.getNotificationRegistry().removeListener(observable,
+        scInstance.getNotificationRegistry().removeListener(observable,
             listener);
     }
 
@@ -386,7 +387,7 @@
     public void addListener(final Transition transition,
             final SCXMLListener listener) {
         Object observable = transition;
-        registry.getNotificationRegistry().addListener(observable, listener);
+        scInstance.getNotificationRegistry().addListener(observable, listener);
     }
 
     /**
@@ -398,11 +399,20 @@
     public void removeListener(final Transition transition,
             final SCXMLListener listener) {
         Object observable = transition;
-        registry.getNotificationRegistry().removeListener(observable,
+        scInstance.getNotificationRegistry().removeListener(observable,
             listener);
     }
 
     /**
+     * Get the state chart instance for this executor.
+     *
+     * @return The SCInstance for this executor.
+     */
+    SCInstance getSCInstance() {
+        return scInstance;
+    }
+
+    /**
      * Log the current set of active states.
      */
     private void logState() {
@@ -426,7 +436,7 @@
      */
     private void updateStatus(final Step step) {
         currentStatus = step.getAfterStatus();
-        registry.getRootContext().setLocal("_ALL_STATES",
+        scInstance.getRootContext().setLocal("_ALL_STATES",
             SCXMLHelper.getAncestorClosure(currentStatus.getStates(), null));
     }
 

Modified: jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/SCXMLSemantics.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/SCXMLSemantics.java?rev=374978&r1=374977&r2=374978&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/SCXMLSemantics.java
(original)
+++ jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/SCXMLSemantics.java
Sat Feb  4 23:29:32 2006
@@ -68,15 +68,15 @@
      *            a list of States and Parallels to enter
      * @param errRep
      *            ErrorReporter callback
-     * @param registry
-     *            The registry
+     * @param scInstance
+     *            The state chart instance
      *
      * @throws ModelException
      *             in case there is a fatal SCXML object model problem.
      */
     void determineInitialStates(final SCXML input, final Set states,
             final List entryList, final ErrorReporter errRep,
-            final Registry registry)
+            final SCInstance scInstance)
     throws ModelException;
 
     /**
@@ -91,15 +91,15 @@
      *            the event dispatcher - EventDispatcher instance
      * @param errRep
      *            error reporter
-     * @param registry
-     *            The registry
+     * @param scInstance
+     *            The state chart instance
      *
      * @throws ModelException
      *             in case there is a fatal SCXML object model problem.
      */
     void executeActions(final Step step, final SCXML stateMachine,
             final EventDispatcher evtDispatcher, final ErrorReporter errRep,
-            final Registry registry)
+            final SCInstance scInstance)
     throws ModelException;
 
     /**
@@ -123,11 +123,11 @@
      *            with current status
      * @param errRep
      *            ErrorReporter callback
-     * @param registry
-     *            The registry
+     * @param scInstance
+     *            The state chart instance
      */
     void filterTransitionsSet(final Step step, final ErrorReporter errRep,
-            final Registry registry);
+            final SCInstance scInstance);
 
     /**
      * Follow the candidate transitions for this execution Step, and update the
@@ -135,13 +135,13 @@
      *
      * @param step The current Step
      * @param errorReporter The ErrorReporter for the current environment
-     * @param registry The registry
+     * @param scInstance The state chart instance
      *
      * @throws ModelException
      *             in case there is a fatal SCXML object model problem.
      */
     void followTransitions(final Step step, final ErrorReporter errorReporter,
-            final Registry registry)
+            final SCInstance scInstance)
     throws ModelException;
 
     /**
@@ -152,11 +152,11 @@
      *            The current Step
      * @param errRep
      *            ErrorReporter callback
-     * @param registry
-     *            The registry
+     * @param scInstance
+     *            The state chart instance
      */
     void updateHistoryStates(final Step step, final ErrorReporter errRep,
-            final Registry registry);
+            final SCInstance scInstance);
 
 }
 

Modified: jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/semantics/SCXMLSemanticsImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/semantics/SCXMLSemanticsImpl.java?rev=374978&r1=374977&r2=374978&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/semantics/SCXMLSemanticsImpl.java
(original)
+++ jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/semantics/SCXMLSemanticsImpl.java
Sat Feb  4 23:29:32 2006
@@ -36,7 +36,7 @@
 import org.apache.commons.scxml.Evaluator;
 import org.apache.commons.scxml.EventDispatcher;
 import org.apache.commons.scxml.NotificationRegistry;
-import org.apache.commons.scxml.Registry;
+import org.apache.commons.scxml.SCInstance;
 import org.apache.commons.scxml.SCXMLExpressionException;
 import org.apache.commons.scxml.SCXMLHelper;
 import org.apache.commons.scxml.SCXMLSemantics;
@@ -108,14 +108,14 @@
      *            a list of States and Parallels to enter [out]
      * @param errRep
      *            ErrorReporter callback [inout]
-     * @param registry
-     *            The registry [in]
+     * @param scInstance
+     *            The state chart instance [in]
      * @throws ModelException
      *             in case there is a fatal SCXML object model problem.
      */
     public void determineInitialStates(final SCXML input, final Set states,
             final List entryList, final ErrorReporter errRep,
-            final Registry registry)
+            final SCInstance scInstance)
             throws ModelException {
         State tmp = input.getInitialState();
         if (tmp == null) {
@@ -123,7 +123,7 @@
                     "SCXML initialstate is missing!", input);
         } else {
             states.add(tmp);
-            determineTargetStates(states, errRep, registry);
+            determineTargetStates(states, errRep, scInstance);
             //set of ALL entered states (even if initialState is a jump-over)
             Set onEntry = SCXMLHelper.getAncestorClosure(states, null);
             // sort onEntry according state hierarchy
@@ -147,8 +147,8 @@
      *            the event dispatcher - EventDispatcher instance
      * @param errRep
      *            ErrorReporter callback [inout]
-     * @param registry
-     *            The registry [inout]
+     * @param scInstance
+     *            The state chart instance [inout]
      * @throws ModelException
      *             in case there is a fatal SCXML object model problem
      * @throws SCXMLExpressionException
@@ -163,16 +163,16 @@
     public void executeActionList(final List actions,
             final Collection derivedEvents,
             final EventDispatcher evtDispatcher, final ErrorReporter errRep,
-            final Registry registry)
+            final SCInstance scInstance)
     throws ModelException, SCXMLExpressionException {
-        Evaluator eval = registry.getEvaluator();
+        Evaluator eval = scInstance.getEvaluator();
         // NOTE: "if" statement is a container - we may need to call this method
         // recursively and pass a sub-list of actions embedded in a particular
         // "if"
         for (Iterator i = actions.iterator(); i.hasNext();) {
             Action a = (Action) i.next();
             State parentState = a.getParentState();
-            Context ctx = registry.getContext(parentState);
+            Context ctx = scInstance.getContext(parentState);
             // NOTE: "elseif" and "else" do not appear here, since they are
             // always handled as a part of "if" as a container
             if (a instanceof Assign) {
@@ -226,7 +226,7 @@
                 }
                 if (!todoList.isEmpty()) {
                     executeActionList(todoList, derivedEvents, evtDispatcher,
-                        errRep, registry);
+                        errRep, scInstance);
                 }
                 todoList.clear();
             } else if (a instanceof Log) {
@@ -295,16 +295,16 @@
      *            the event dispatcher - EventDispatcher instance
      * @param errRep
      *            error reporter
-     * @param registry
-     *            The registry
+     * @param scInstance
+     *            The state chart instance
      * @throws ModelException
      *             in case there is a fatal SCXML object model problem.
      */
     public void executeActions(final Step step, final SCXML stateMachine,
             final EventDispatcher evtDispatcher,
-            final ErrorReporter errRep, final Registry registry)
+            final ErrorReporter errRep, final SCInstance scInstance)
     throws ModelException {
-        NotificationRegistry nr = registry.getNotificationRegistry();
+        NotificationRegistry nr = scInstance.getNotificationRegistry();
         Collection internalEvents = step.getAfterStatus().getEvents();
         // ExecutePhaseActions / OnExit
         for (Iterator i = step.getExitList().iterator(); i.hasNext();) {
@@ -312,7 +312,7 @@
             OnExit oe = tt.getOnExit();
             try {
                 executeActionList(oe.getActions(), internalEvents,
-                    evtDispatcher, errRep, registry);
+                    evtDispatcher, errRep, scInstance);
             } catch (SCXMLExpressionException e) {
                 errRep.onError(ErrorReporter.EXPRESSION_ERROR, e.getMessage(),
                         oe);
@@ -328,7 +328,7 @@
             Transition t = (Transition) i.next();
             try {
                 executeActionList(t.getActions(), internalEvents,
-                    evtDispatcher, errRep, registry);
+                    evtDispatcher, errRep, scInstance);
             } catch (SCXMLExpressionException e) {
                 errRep.onError(ErrorReporter.EXPRESSION_ERROR,
                     e.getMessage(), t);
@@ -343,7 +343,7 @@
             OnEntry oe = tt.getOnEntry();
             try {
                 executeActionList(oe.getActions(), internalEvents,
-                    evtDispatcher, errRep, registry);
+                    evtDispatcher, errRep, scInstance);
             } catch (SCXMLExpressionException e) {
                 errRep.onError(ErrorReporter.EXPRESSION_ERROR, e.getMessage(),
                         oe);
@@ -440,11 +440,11 @@
      *            [inout]
      * @param errRep
      *            ErrorReporter callback [inout]
-     * @param registry
-     *            The registry [in]
+     * @param scInstance
+     *            The state chart instance [in]
      */
     public void filterTransitionsSet(final Step step,
-            final ErrorReporter errRep, final Registry registry) {
+            final ErrorReporter errRep, final SCInstance scInstance) {
         /*
          * - filter transition set by applying events
          * (step/beforeStatus/events + step/externalEvents) (local check)
@@ -486,7 +486,7 @@
                 rslt = Boolean.TRUE;
             } else {
                 try {
-                    rslt = registry.getEvaluator().evalCond(registry.
+                    rslt = scInstance.getEvaluator().evalCond(scInstance.
                             getContext(t.getParent()), t.getCond());
                 } catch (SCXMLExpressionException e) {
                     rslt = Boolean.FALSE;
@@ -604,13 +604,13 @@
      *            a set seeded in previous step [inout]
      * @param errRep
      *            ErrorReporter callback [inout]
-     * @param registry
-     *            The registry [in]
+     * @param scInstance
+     *            The state chart instance [in]
      * @throws ModelException On illegal configuration
      * @see #seedTargetSet(Set, List, ErrorReporter)
      */
     public void determineTargetStates(final Set states,
-            final ErrorReporter errRep, final Registry registry)
+            final ErrorReporter errRep, final SCInstance scInstance)
     throws ModelException {
         LinkedList wrkSet = new LinkedList(states);
         // clear the seed-set - will be populated by leaf states
@@ -663,10 +663,10 @@
                 }
             } else if (tt instanceof History) {
                 History h = (History) tt;
-                if (registry.isEmpty(h)) {
+                if (scInstance.isEmpty(h)) {
                     wrkSet.addLast(h.getTransition().getRuntimeTarget());
                 } else {
-                    wrkSet.addAll(registry.getLastConfiguration(h));
+                    wrkSet.addAll(scInstance.getLastConfiguration(h));
                 }
             } else {
                 throw new ModelException("Unknown TransitionTarget subclass:"
@@ -683,11 +683,11 @@
      *            [inout]
      * @param errRep
      *            ErrorReporter callback [inout]
-     * @param registry
-     *            The registry [inout]
+     * @param scInstance
+     *            The state chart instance [inout]
      */
     public void updateHistoryStates(final Step step,
-            final ErrorReporter errRep, final Registry registry) {
+            final ErrorReporter errRep, final SCInstance scInstance) {
         Set oldState = step.getBeforeStatus().getStates();
         for (Iterator i = step.getExitList().iterator(); i.hasNext();) {
             Object o = i.next();
@@ -711,7 +711,7 @@
                                     }
                                 }
                             }
-                            registry.setLastConfiguration(h, deep);
+                            scInstance.setLastConfiguration(h, deep);
                         } else {
                             if (shallow == null) {
                                 //calculate shallow history for a given state
@@ -721,7 +721,7 @@
                                 shallow.retainAll(SCXMLHelper
                                         .getAncestorClosure(oldState, null));
                             }
-                            registry.setLastConfiguration(h, shallow);
+                            scInstance.setLastConfiguration(h, shallow);
                         }
                     }
                     shallow = null;
@@ -767,13 +767,13 @@
      *
      * @param step The current Step
      * @param errorReporter The ErrorReporter for the current environment
-     * @param registry The registry
+     * @param scInstance The state chart instance
      *
      * @throws ModelException
      *             in case there is a fatal SCXML object model problem.
      */
     public void followTransitions(final Step step,
-            final ErrorReporter errorReporter, final Registry registry)
+            final ErrorReporter errorReporter, final SCInstance scInstance)
     throws ModelException {
         Set currentStates = step.getBeforeStatus().getStates();
         List transitions = step.getTransitList();
@@ -792,7 +792,7 @@
         // DetermineTargetStates (initialTargetSet) -> targetSet
         Set targetSet = step.getAfterStatus().getStates();
         targetSet.addAll(seedSet); //copy to preserve seedSet
-        determineTargetStates(targetSet, errorReporter, registry);
+        determineTargetStates(targetSet, errorReporter, scInstance);
         // BuildOnEntryList (targetSet, seedSet) -> entryList
         Set entered = SCXMLHelper.getAncestorClosure(targetSet, seedSet);
         seedSet.clear();



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


Mime
View raw message