commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbe...@apache.org
Subject svn commit: r954060 - in /commons/sandbox/gsoc/2010/scxml-js/trunk: src/scxml/cgf/SCXMLCompiler.js test/xslt/AbstractStatechartGenerator.xsl
Date Sat, 12 Jun 2010 19:35:11 GMT
Author: jbeard
Date: Sat Jun 12 19:35:10 2010
New Revision: 954060

URL: http://svn.apache.org/viewvc?rev=954060&view=rev
Log:
Intermediate commit. Refactor transition logic to take out params, and moved transformations
into SCXMLCompiler. Looks much cleaner. Now to debug it and make it work.

Modified:
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js
    commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractStatechartGenerator.xsl

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js?rev=954060&r1=954059&r2=954060&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js Sat Jun 12 19:35:10
2010
@@ -308,11 +308,62 @@ require.def("src/scxml/cgf/SCXMLCompiler
 					});
 				});
 
-				/*
-				util.foreach(conf.allStates,function(s){
-					s.@msdl::depth = computeDepth(s);				
+
+				util.foreach(scxmlRoot..state,function(state){
+					state.@msdl::isParallelSubstate = conf.parallelRegions..*.contains(state);
+					state.@msdl::isBasic = conf.basicStates.contains(state);
 				});
-				*/
+
+				util.foreach(scxmlRoot..transition,function(transition){
+
+					var sourceState = transition.parent();
+
+					var targetId = transition.msdl::targets.msdl::target.msdl::targetState[0].toString();
+					var transitionTarget = conf.allStates.(@id == targetId);
+
+					//we use these funky-looking variables to avoid namespace collisions in the below query
+					var $s = state, $t = transitionTarget;
+					transition.@doesNotExitParallelRegion = conf.parallelRegions.( 
+								descendants($s.localName()).contains($s) &&
+									descendants($t.localName()).contains($t)).length();
+
+					//set whether he is preempted
+					transition.@isPreempted = 
+						conf.parallelsAndDescendantStates.contains(sourceState) && 
+							!conf.parallelsAndDescendantStates.contains(transitionTarget);
+
+					toReturn = self.genTriggerDispatcherContext(transitionParams,state,transition);
+
+				});
+				
+				
+				self.genStateTriggerDispatcher = function(state,transition){
+					//so, this will vary depending on whether he is a basic state in a non-parallel region,
a non-basic state, or a history state. 
+					//so, we do a check, and then delegate to the proper method
+					
+					//we also need to know the lca here.
+					var toReturn;
+
+					var transitionParams = {};
+
+
+					transitionParams.isInitial = (state.localName() == "initial");
+
+					//is he a history state?
+					transitionParams.isHistory = (state.localName() == "history");
+					
+					//conf.statesDescendedFromParallelRegions.contains(transitionTarget))
+					//conf.statesDescendedFromParallelRegions.contains(state) && 
+
+					//TODO: get his corresponding parallel region, and check if target state is a descendant
of the parallel region
+					//is basic, and is a descendant of a parallel state
+
+					transitionParams.isParallelSubstate = conf.parallelRegions..*.contains(state);
+
+					//we use these funky-looking variables to avoid namespace collisions in the below query
+					return toReturn;
+				}
+
 
 				return scxmlRoot;
 

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractStatechartGenerator.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractStatechartGenerator.xsl?rev=954060&r1=954059&r2=954060&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractStatechartGenerator.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractStatechartGenerator.xsl Sat
Jun 12 19:35:10 2010
@@ -587,7 +587,7 @@
 			<when test="local-name($s) = 'initial' or local-name($s) = 'history' or 
 						( $s/@isBasic and 
 							( not($s/@isParallelSubstate) or 
-								$s/@isParallelSubstateAndTransitionDoesNotExitParallelRegion))">
+								($s/@isParallelSubstate and $t/doesNotExitParallelRegion)))">
 				<for-each select="$t/c:exitpath/c:state">
 					<value-of select="."/>.exitAction();
 				</for-each>
@@ -609,7 +609,7 @@
 
 		//update configuration
 		<choose>
-			<when test="$s/@isParallelSubstateAndTransitionDoesNotExitParallelRegion">
+			<when test="$s/@isParallelSubstate and $t/doesNotExitParallelRegion">
 				<call-template name="genParallelSubstateConfigurationSetString">
 					<with-param name="s" select="$s"/>
 					<with-param name="t" select="$t"/>



Mime
View raw message