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);
}
* viewed, it becomes immutable
*/
static class Ref<T> extends Forest<T> {
+ public HashSet<GSS.Phase.Node> parents = new HashSet<GSS.Phase.Node>();
+ public boolean contains(Forest f) {
+ return hp.contains(f);
+ }
public boolean ambiguous() {
if (hp.size()==0) return false;
if (hp.size()==1) return hp.iterator().next().ambiguous();