/** assume that this forest contains exactly one tree and return it; otherwise throw an exception */
public abstract Tree<T> expand1() throws Ambiguous;
/** assume that this forest contains exactly one tree and return it; otherwise throw an exception */
public abstract Tree<T> expand1() throws Ambiguous;
return new One<T>(loc, head, children, unwrap);
}
return new One<T>(loc, head, children, unwrap);
}
// Package-Private //////////////////////////////////////////////////////////////////////////////
abstract void expand(HashSet<Tree<T>> ht, HashSet<Forest<T>> ignore, Tree<T> bogus);
// Package-Private //////////////////////////////////////////////////////////////////////////////
abstract void expand(HashSet<Tree<T>> ht, HashSet<Forest<T>> ignore, Tree<T> bogus);
// One //////////////////////////////////////////////////////////////////////////////
/** A "single" forest with a head and child subforests */
// One //////////////////////////////////////////////////////////////////////////////
/** A "single" forest with a head and child subforests */
return new Tree<T>(location, head, ret, unwrap);
}
return new Tree<T>(location, head, ret, unwrap);
}
if (ignore.contains(this)) { ht.add(bogus); return; }
expand(0, new Tree[children.length], ht, ignore, bogus);
}
if (ignore.contains(this)) { ht.add(bogus); return; }
expand(0, new Tree[children.length], ht, ignore, bogus);
}
// Many //////////////////////////////////////////////////////////////////////////////
/** An "ambiguity node"; this is immutable once it has been "looked at" */
// Many //////////////////////////////////////////////////////////////////////////////
/** An "ambiguity node"; this is immutable once it has been "looked at" */
HashSet<GSS.Phase.Node> parents = new HashSet<GSS.Phase.Node>();
private FastSet<Forest<T>> hp = new FastSet<Forest<T>>();
HashSet<GSS.Phase.Node> parents = new HashSet<GSS.Phase.Node>();
private FastSet<Forest<T>> hp = new FastSet<Forest<T>>();
FastSet<Forest<T>> f2 = new FastSet<Forest<T>>();
for(Forest f : hp)
if (f instanceof Forest.One) f2.add(f);
else for(Forest ff : ((Forest.Many<T>)f))
f2.add(ff);
hp = f2;
FastSet<Forest<T>> f2 = new FastSet<Forest<T>>();
for(Forest f : hp)
if (f instanceof Forest.One) f2.add(f);
else for(Forest ff : ((Forest.Many<T>)f))
f2.add(ff);
hp = f2;
touched();
if (ignore.contains(this)) { ht.add(bogus); return; }
for (Forest<T> f : hp) f.expand(ht, ignore, bogus);
touched();
if (ignore.contains(this)) { ht.add(bogus); return; }
for (Forest<T> f : hp) f.expand(ht, ignore, bogus);