[Swift-commit] r5834 - trunk/src/org/griphyn/vdl/karajan/lib
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Sat Jul 14 19:01:19 CDT 2012
Author: hategan
Date: 2012-07-14 19:01:19 -0500 (Sat, 14 Jul 2012)
New Revision: 5834
Modified:
trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
trunk/src/org/griphyn/vdl/karajan/lib/ThrottledParallelFor.java
Log:
nicer toString (in particular for traces)
Modified: trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java 2012-07-15 00:00:00 UTC (rev 5833)
+++ trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java 2012-07-15 00:01:19 UTC (rev 5834)
@@ -44,6 +44,8 @@
static {
setArguments(SetFieldValue.class, new Arg[] { OA_PATH, PA_VAR, PA_VALUE });
}
+
+ private String src, dest;
public Object function(VariableStack stack) throws ExecutionException {
DSHandle var = (DSHandle) PA_VAR.getValue(stack);
@@ -52,6 +54,11 @@
DSHandle leaf = var.getField(path);
AbstractDataNode value = (AbstractDataNode) PA_VALUE.getValue(stack);
+ if (src == null) {
+ dest = getVarName(var);
+ src = getVarName(value);
+ }
+
log(leaf, value);
// TODO want to do a type check here, for runtime type checking
@@ -72,7 +79,17 @@
}
}
- @SuppressWarnings("unchecked")
+ private String getVarName(DSHandle var) {
+ String name = var.getRoot().getParam("dbgname");
+ if (var == var.getRoot()) {
+ return name;
+ }
+ else {
+ return name + var.getPathFromRoot();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
private void log(DSHandle leaf, DSHandle value) {
if (logger.isDebugEnabled()) {
logger.debug("Setting " + leaf + " to " + value);
@@ -194,4 +211,12 @@
}
}
-}
+ @Override
+ public String getTextualName() {
+ if (src == null) {
+ return "assignment";
+ }
+ else {
+ return dest + " = " + src;
+ }
+ }}
Modified: trunk/src/org/griphyn/vdl/karajan/lib/ThrottledParallelFor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/ThrottledParallelFor.java 2012-07-15 00:00:00 UTC (rev 5833)
+++ trunk/src/org/griphyn/vdl/karajan/lib/ThrottledParallelFor.java 2012-07-15 00:01:19 UTC (rev 5834)
@@ -182,8 +182,13 @@
throws VariableNotFoundException {
return (ThreadCount) stack.getVar(THREAD_COUNT);
}
+
+ @Override
+ public String getTextualName() {
+ return "foreach";
+ }
- private static class ThreadCount implements FutureIterator {
+ private static class ThreadCount implements FutureIterator {
private int maxThreadCount;
private int crt;
private boolean selfClose, closed;
More information about the Swift-commit
mailing list