[Swift-commit] r3483 - trunk/src/org/griphyn/vdl/engine

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Wed Jul 28 14:35:07 CDT 2010


Author: hategan
Date: 2010-07-28 14:35:07 -0500 (Wed, 28 Jul 2010)
New Revision: 3483

Modified:
   trunk/src/org/griphyn/vdl/engine/Karajan.java
Log:
do not instantiate mappers for primitive types; instantiate constant string mapper params directly

Modified: trunk/src/org/griphyn/vdl/engine/Karajan.java
===================================================================
--- trunk/src/org/griphyn/vdl/engine/Karajan.java	2010-07-28 19:33:57 UTC (rev 3482)
+++ trunk/src/org/griphyn/vdl/engine/Karajan.java	2010-07-28 19:35:07 UTC (rev 3483)
@@ -401,7 +401,7 @@
 						pparamST.setAttribute("name", "prefix");
 						pparamST.setAttribute("expr", parameterVariableName + "-" + UUIDGenerator.getInstance().generateRandomBasedUUID().toString());
 						pmappingST.setAttribute("params", pparamST);
-						variableDeclarationST.setAttribute("mapping", pmappingST);
+						//variableDeclarationST.setAttribute("mapping", pmappingST);
 						variableDeclarationST.setAttribute("nil", Boolean.TRUE);
 						variableDeclarationST.setAttribute("name", parameterVariableName);
 						scope.bodyTemplate.setAttribute("declarations",variableDeclarationST);
@@ -415,7 +415,14 @@
 						variableAssignmentST.setAttribute("var",variableReferenceST);
 						variableAssignmentST.setAttribute("value",paramValueST);
 						scope.appendStatement(variableAssignmentST);
-						paramST.setAttribute("expr",variableReferenceST);
+						if (param.getAbstractExpression().getDomNode().getNodeName().equals("stringConstant")) {
+							StringTemplate valueST = template("sConst");
+							valueST.setAttribute("innervalue", param.getAbstractExpression().getDomNode().getFirstChild().getNodeValue());
+                            paramST.setAttribute("expr",valueST); 
+                        }
+                        else {
+                        	paramST.setAttribute("expr",variableReferenceST);
+                        }
 					}
 					mappingST.setAttribute("params", paramST);
 				}
@@ -423,15 +430,17 @@
 			}
 		} else {
 			// add temporary mapping info
-			StringTemplate mappingST = new StringTemplate("mapping");
-			mappingST.setAttribute("descriptor", "concurrent_mapper");
-			StringTemplate paramST = template("vdl_parameter");
-			paramST.setAttribute("name", "prefix");
-			paramST.setAttribute("expr", var.getName() + "-"
-					+ UUIDGenerator.getInstance().generateRandomBasedUUID().toString());
-			mappingST.setAttribute("params", paramST);
-			variableST.setAttribute("mapping", mappingST);
-			variableST.setAttribute("nil", Boolean.TRUE);
+			if (!org.griphyn.vdl.type.Types.isPrimitive(var.getType().getLocalPart())) {
+    			StringTemplate mappingST = new StringTemplate("mapping");
+    			mappingST.setAttribute("descriptor", "concurrent_mapper");
+    			StringTemplate paramST = template("vdl_parameter");
+    			paramST.setAttribute("name", "prefix");
+    			paramST.setAttribute("expr", var.getName() + "-"
+    					+ UUIDGenerator.getInstance().generateRandomBasedUUID().toString());
+    			mappingST.setAttribute("params", paramST);
+    			variableST.setAttribute("mapping", mappingST);
+    			variableST.setAttribute("nil", Boolean.TRUE);
+			}
 		}
 
 		scope.bodyTemplate.setAttribute("declarations", variableST);




More information about the Swift-commit mailing list