- private static class MultiForest<T> extends Forest<T> {
- private final FastSet<Body<T>> results = new FastSet<Body<T>>();
- public MultiForest(Body<T> b) { results.add(b); }
- public Iterator<Body<T>> iterator() { return results.iterator(); }
+ public abstract <B,C> void visit(Invokable<Forest.Body<T>,B,C> ivbc, B b, C c);
+ private static class TreeMaker<T> extends HashSet<Tree<T>> implements Invokable<Forest.Body<T>,Boolean,Integer> {
+ public ArrayList<Tree<T>> toks = new ArrayList<Tree<T>>();
+ public void invoke(Forest.Body<T> bod, Boolean toss, Integer i) {
+ if (i==null) {
+ ArrayList<Tree<T>> toks = this.toks;
+ this.toks = new ArrayList<Tree<T>>();
+ bod.expand(toss, 0, this);
+ this.toks = toks;
+ } else {
+ bod.expand(toss, i, this);
+ }
+ }