checkpoint
[sbp.git] / src / edu / berkeley / sbp / misc / Demo.java
index b6c0524..dbe6266 100644 (file)
@@ -89,23 +89,7 @@ public class Demo {
             return false;
         }
         public Object repeatTag() {
-            return new Functor<Iterable<Tree>,Object>() {
-                    public String toString() { return ""; }
-                    public Object invoke(Iterable<Tree> t) {
-                        ArrayList ret = new ArrayList();
-                        for(Tree tc : t) {
-                            if (tc.head() != null && tc.head() instanceof Functor)
-                                ret.add(((Functor<Iterable<Tree>,Object>)tc.head()).invoke(tc.children()));
-                            else if (tc.numChildren() == 0)
-                                ret.add(tc.head());
-                            else {
-                                System.err.println("FIXME: don't know what to do about " + tc);
-                                ret.add(null);
-                            }
-                        }
-                        return ret.toArray(new Object[0]);
-                    }
-                };
+            return new Tree.ArrayBuildingTreeFunctor<Object>();
         }
         public Sequence tryResolveTag(String tag, String nonTerminalName, Element[] els, Object[] labels, boolean[] drops) {
             Production p = new Production(tag, nonTerminalName, els, labels, drops);