tentative checkpoint
[sbp.git] / src / edu / berkeley / sbp / Forest.java
index 12c8cf1..bc31117 100644 (file)
@@ -7,7 +7,10 @@ import java.util.*;
 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++;
@@ -156,6 +159,10 @@ public abstract class Forest<T> /*extends PrintableTree<Forest.MyBody<T>>*/ impl
      *  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();