public Many() { }
+ public Iterator<One<T>> iterator() {
+ touched();
+ return (Iterator<One<T>>)hp.iterator(); // FIXME: fastset's iterator is not safe!
+ }
+
public Tree<T> expand1() throws Ambiguous {
touched();
if (hp.size() > 1) {
}
private void touched() {
+ if (touched) return;
touched = true;
+ 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)f))
+ f2.add(ff);
+ hp = f2;
}
public boolean contains(Forest f) {
touched();