import java.lang.reflect.*;
/** an efficient representation of a collection of trees (Tomita's shared packed parse forest) */
-public abstract class Forest<T> /*extends PrintableTree<Forest.MyBody<T>>*/ implements Visitable<Forest.Body<T>>, IntegerMappable, GraphViz.ToGraphViz {
+public abstract class Forest<T> /*extends PrintableTree<Forest.MyBody<T>>*/
+ implements Visitable<Forest.Body<T>>,
+ IntegerMappable,
+ GraphViz.ToGraphViz {
private static int master_idx = 0;
private final int idx = master_idx++;
public InnerAmbiguous(Forest<?> f) { this.f = f; }
}
- public static interface TreeConsumer<T> {
+ static interface TreeConsumer<T> {
public void addTree(Tree<T> t);
}
- public static class HashSetTreeConsumer<T> extends HashSet<Tree<T>> implements TreeConsumer<T> {
+ static class HashSetTreeConsumer<T> extends HashSet<Tree<T>> implements TreeConsumer<T> {
public void addTree(Tree<T> t) {
super.add(t);
}
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.label = StringUtil.escapify(headToString()==null?"":headToString(), "\r\n");
n.directed = true;
n.comment = reduction==null?null:reduction+"";
edges(n);