[Swift-commit] r5419 - branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Wed Dec 14 16:03:11 CST 2011


Author: hategan
Date: 2011-12-14 16:03:11 -0600 (Wed, 14 Dec 2011)
New Revision: 5419

Modified:
   branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Misc.java
Log:
also pretty-print arrays

Modified: branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Misc.java
===================================================================
--- branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Misc.java	2011-12-14 22:02:35 UTC (rev 5418)
+++ branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Misc.java	2011-12-14 22:03:11 UTC (rev 5419)
@@ -1,6 +1,7 @@
 package org.griphyn.vdl.karajan.lib.swiftscript;
 
 import java.io.IOException;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -15,8 +16,8 @@
 import org.griphyn.vdl.karajan.lib.VDLFunction;
 import org.griphyn.vdl.mapping.AbsFile;
 import org.griphyn.vdl.mapping.AbstractDataNode;
-import org.griphyn.vdl.mapping.ArrayDataNode;
 import org.griphyn.vdl.mapping.DSHandle;
+import org.griphyn.vdl.mapping.HandleOpenException;
 import org.griphyn.vdl.mapping.InvalidPathException;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.RootArrayDataNode;
@@ -83,7 +84,23 @@
     	    if (h.getType().isPrimitive()) {
     	        buf.append(o);
     	    }
-    	    
+    	    else if (h.getType().isArray()) {
+    	        try {
+    	            Iterator<DSHandle> i = h.getFields(Path.CHILDREN).iterator();
+    	            buf.append('[');
+    	            while (i.hasNext()) {
+    	                prettyPrint(buf, i.next());
+    	                if (i.hasNext()) {
+    	                    buf.append(", ");
+    	                }
+    	            }
+    	            buf.append(']');
+    	        }
+    	        catch (HandleOpenException e) {
+    	        }
+                catch (InvalidPathException e) {
+                }
+    	    }
 	    }
     }
 




More information about the Swift-commit mailing list