[Swift-commit] r6051 - in trunk/src/org/griphyn/vdl: karajan/lib mapping

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Sat Nov 17 01:06:39 CST 2012


Author: hategan
Date: 2012-11-17 01:06:38 -0600 (Sat, 17 Nov 2012)
New Revision: 6051

Modified:
   trunk/src/org/griphyn/vdl/karajan/lib/New.java
   trunk/src/org/griphyn/vdl/karajan/lib/Tracer.java
   trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java
   trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java
   trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
Log:
moved formatting of mapper parameters to MappingParamSet and a few more tweaks to tracing

Modified: trunk/src/org/griphyn/vdl/karajan/lib/New.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/New.java	2012-11-17 07:05:30 UTC (rev 6050)
+++ trunk/src/org/griphyn/vdl/karajan/lib/New.java	2012-11-17 07:06:38 UTC (rev 6051)
@@ -179,7 +179,7 @@
 				}
 				else {
 				    if (tracer.isEnabled()) {
-                        tracer.trace(threadPrefix, dbgname + formatMPS(mps));
+                        tracer.trace(threadPrefix, dbgname + " " + mps);
                     }
 				}
 			}
@@ -194,36 +194,6 @@
 		}
 	}
 
-    private String formatMPS(MappingParamSet mps) {
-        Object desc = mps.get(MappingParam.SWIFT_DESCRIPTOR);
-        if (desc == null) {
-            return "";
-        }
-        StringBuilder sb = new StringBuilder();
-        sb.append(" <");
-        sb.append(desc);
-        sb.append("; ");
-        boolean first = true;
-        for (String name : mps.names()) {
-        	if (name.indexOf('#') >= 0) {
-        		// skip internal parameters
-        		continue;
-        	}
-            if (first) {
-                first = false;
-            }
-            else {
-                sb.append(", ");
-            }
-            sb.append(name);
-            sb.append(" = \"");
-            sb.append(Tracer.unwrapHandle(mps._get(name)));
-            sb.append("\"");
-        }
-        sb.append('>');
-        return sb.toString();
-    }
-
     private String formatList(List<?> value) {
         StringBuilder sb = new StringBuilder();
         sb.append('[');

Modified: trunk/src/org/griphyn/vdl/karajan/lib/Tracer.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/Tracer.java	2012-11-17 07:05:30 UTC (rev 6050)
+++ trunk/src/org/griphyn/vdl/karajan/lib/Tracer.java	2012-11-17 07:06:38 UTC (rev 6051)
@@ -132,7 +132,7 @@
     public boolean isEnabled() {
         return enabled;
     }
-    
+        
     public void trace(VariableStack stack, Object msg) throws VariableNotFoundException {
         trace(threadName(stack), msg);
     }

Modified: trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java	2012-11-17 07:05:30 UTC (rev 6050)
+++ trunk/src/org/griphyn/vdl/mapping/MappingParamSet.java	2012-11-17 07:06:38 UTC (rev 6051)
@@ -7,6 +7,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.griphyn.vdl.karajan.lib.Tracer;
+
 public class MappingParamSet {
     private Map<String, Object> params;
     
@@ -30,10 +32,6 @@
         return params.get(p.getName());
     }
     
-    public Object _get(String name) {
-        return params.get(name);
-    }
-
     public boolean isPresent(MappingParam p) {
         return params.containsKey(p.getName());
     }
@@ -51,4 +49,30 @@
     public Collection<String> names() {
         return params.keySet();
     }
+
+    @Override
+    public String toString() {
+        Object desc = get(MappingParam.SWIFT_DESCRIPTOR);
+        if (desc == null) {
+            return "";
+        }
+        StringBuilder sb = new StringBuilder();
+        sb.append("<");
+        sb.append(desc);
+        sb.append("; ");
+        sb.append("input = " + get(MappingParam.SWIFT_INPUT));
+        for (String name : names()) {
+            if (name.indexOf('#') >= 0) {
+                // skip internal parameters
+                continue;
+            }
+            sb.append(", ");
+            sb.append(name);
+            sb.append(" = \"");
+            sb.append(Tracer.unwrapHandle(params.get(name)));
+            sb.append("\"");
+        }
+        sb.append('>');
+        return sb.toString();
+    }
 }

Modified: trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java	2012-11-17 07:05:30 UTC (rev 6050)
+++ trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java	2012-11-17 07:06:38 UTC (rev 6051)
@@ -146,7 +146,7 @@
         initialized = true;
         waitingMapperParam = null;
         if (tracer.isEnabled()) {
-            tracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " INITIALIZED");
+            tracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " INITIALIZED " + params);
         }
     }
 }

Modified: trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootDataNode.java	2012-11-17 07:05:30 UTC (rev 6050)
+++ trunk/src/org/griphyn/vdl/mapping/RootDataNode.java	2012-11-17 07:06:38 UTC (rev 6051)
@@ -135,8 +135,9 @@
 					// Try to get the path in order to check that the 
 				    // path is valid - we'll get an exception if not
 					root.getField(p);
-					if (logger.isInfoEnabled()) {
-						logger.info("Found mapped data " + root + "." + p);
+					if (tracer.isEnabled()) {
+					    tracer.trace(root.getThread(), root.getDeclarationLine(), 
+					        root.getDisplayableName() + " MAPPING " + p + ", " + mapper.map(p));
 					}
 				}
 				catch (InvalidPathException e) {
@@ -247,7 +248,7 @@
 		initialized = true;
 		waitingMapperParam = null;
 		if (tracer.isEnabled()) {
-            tracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " INITIALIZED");
+            tracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " INITIALIZED " + params);
         }
 	}
 }




More information about the Swift-commit mailing list