import java.lang.reflect.*;
/**
+ * <font color=blue>
* An efficient representation of a collection of trees (Tomita's
* shared packed parse forest).
+ * </font>
*/
public abstract class Forest<T> implements GraphViz.ToGraphViz {
/** expand this forest into a set of trees */
public void expand(HashSet<Tree<T>> ht) { expand(ht, new HashSet<Forest<T>>(), null); }
- /** create a new forest */
- public static <T> Forest<T> create(Input.Region loc, T head, Forest<T>[] children, boolean lift) {
+ static <T> Forest<T> create(Input.Region loc, T head, Forest<T>[] children, boolean lift) {
return new One<T>(loc, head, children, lift);
}
+ /** create a new forest */
+ public static <T> Forest<T> create(Input.Region loc, T head, Forest<T>[] children) {
+ return Forest.create(loc, head, children, false); }
+
// Package-Private //////////////////////////////////////////////////////////////////////////////
abstract void expand(HashSet<Tree<T>> ht, HashSet<Forest<T>> ignore, Tree<T> bogus);
abstract void gather(HashSet<Forest<T>> ignore);
+ abstract void edges(GraphViz.Node n);
boolean ambiguous() { return false; }
- public abstract void edges(GraphViz.Node n);
-
// One //////////////////////////////////////////////////////////////////////////////