- protected static class MyBody<T> extends Forest<T> implements Body<T> /* extends PrintableTree<Forest<T>> implements */, Invokable<Tree<T>, TreeMaker<T>, Integer> {
+ protected static interface Body<T> extends GraphViz.ToGraphViz {
+ void expand(int i, TreeMaker<T> h);
+ }
+ public abstract void edges(GraphViz.Node n);
+ public boolean ambiguous() { return false; }
+ protected static class MyBody<T> extends Forest<T> implements Body<T> /* extends PrintableTree<Forest<T>> implements */ {
+
+ public boolean isTransparent() { return false; }
+ public boolean isHidden() { return false; }
+ public GraphViz.Node toGraphViz(GraphViz gv) {
+ if (gv.hasNode(this)) return gv.createNode(this);
+ GraphViz.Node n = gv.createNode(this);
+ n.label = headToString()==null?"":headToString();
+ n.directed = true;
+ n.comment = reduction==null?null:reduction+"";
+ edges(n);
+ return n;
+ }
+ boolean edges = false;
+ public void edges(GraphViz.Node n) {
+ if (edges) return;
+ edges = true;
+ for(int i=0; i<tokens.length; i++) {
+ if (i==tokens.length-1 && unwrap && !tokens[i].ambiguous()) {
+ tokens[i].edges(n);
+ } else {
+ n.edge(tokens[i], labels==null?null:labels[i]);
+ }
+ }
+ }