projects
/
sbp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add intermediate result between a Node and the "also"s it spawns
[sbp.git]
/
src
/
edu
/
berkeley
/
sbp
/
Node.java
diff --git
a/src/edu/berkeley/sbp/Node.java
b/src/edu/berkeley/sbp/Node.java
index
5c0f023
..
b360071
100644
(file)
--- a/
src/edu/berkeley/sbp/Node.java
+++ b/
src/edu/berkeley/sbp/Node.java
@@
-56,13
+56,8
@@
final class Node
Node child = res.parent();
holder[pos] = res.getForest();
if (pos>0) child.reduce(r, pos-1, target, null);
Node child = res.parent();
holder[pos] = res.getForest();
if (pos>0) child.reduce(r, pos-1, target, null);
- else {
- Reduction reduction =
- new Reduction(child, r, r.rewrite(child.phase().getLocation().createRegion(target.getLocation())), target);
- target.reductionQueue.add(reduction);
- }
+ else new Reduction(child, r, r.rewrite(child.phase().getLocation().createRegion(target.getLocation())), target);
}
}
-
holder[pos] = old;
}
holder[pos] = old;
}
@@
-81,7
+76,7
@@
final class Node
phase.hash.put(state, result.phase(), this);
for(Object s : state.also)
phase.hash.put(state, result.phase(), this);
for(Object s : state.also)
- phase.newNode(result, (State)s, fromEmptyReduction);
+ phase.newNode(new Result(null, this, null), (State)s, fromEmptyReduction);
state.invokeReductions(phase().token, this, true, null);
if (!fromEmptyReduction)
state.invokeReductions(phase().token, this, true, null);
if (!fromEmptyReduction)
@@
-91,14
+86,14
@@
final class Node
// GraphViz //////////////////////////////////////////////////////////////////////////////
public GraphViz.Node toGraphViz(GraphViz gv) {
// GraphViz //////////////////////////////////////////////////////////////////////////////
public GraphViz.Node toGraphViz(GraphViz gv) {
+ if (results.size()==0) return null;
if (gv.hasNode(this)) return gv.createNode(this);
GraphViz.Node n = gv.createNode(this);
n.label = ""+state.toStringx();
n.shape = "rectangle";
boolean hasparents = false;
if (gv.hasNode(this)) return gv.createNode(this);
GraphViz.Node n = gv.createNode(this);
n.label = ""+state.toStringx();
n.shape = "rectangle";
boolean hasparents = false;
- //for(Node parent : parents()) { hasparents = true; n.edge(parent, ""); }
- //for(Forest result : resultMap) n.edge(result, "");
- n.color = !hasparents ? "blue" : /*state.evil ? "red" :*/ "green";
+ for(Result r : results) n.edge(r, "");
+ n.color = state.doomed ? "red" : "green";
((GraphViz.Group)phase().toGraphViz(gv)).add(n);
return n;
}
((GraphViz.Group)phase().toGraphViz(gv)).add(n);
return n;
}