checkpoint
[sbp.git] / src / edu / berkeley / sbp / misc / ReflectiveGrammar.java
index 146335c..5f90b7f 100644 (file)
@@ -8,8 +8,8 @@ import edu.berkeley.sbp.tib.*;
 import edu.berkeley.sbp.chr.*;
 import edu.berkeley.sbp.util.*;
 
-public class ReflectiveGrammar extends MetaGrammar {
-
+public class ReflectiveGrammar /*extends MetaGrammar*/ {
+    /*
     final Class baseClass;
     public ReflectiveGrammar(Class baseClass) { this.baseClass = baseClass; }
 
@@ -55,7 +55,6 @@ public class ReflectiveGrammar extends MetaGrammar {
         } else if (h==arrayMark && c==null) {
             c = Object[].class;            
         }
-        if (c==null) System.out.println(h + " -- " + t.toPrettyString());
         if (c.isArray()) {
             Object[] ret = new Object[t.numChildren()];
             for(int i=0; i<ret.length; i++)
@@ -73,7 +72,7 @@ public class ReflectiveGrammar extends MetaGrammar {
     }
 
     public Object buildBody(Tree<Object> t, Class c) throws Exception {
-        System.out.println("buildBody " + (c==null?null:c.getName()) + " " + t);
+        //System.out.println("buildBody " + (c==null?null:c.getName()) + " " + t);
         c = resolveClass(t, c);
         if (c==null) return buildHead(t, null);
         Object o = c.newInstance();
@@ -98,7 +97,7 @@ public class ReflectiveGrammar extends MetaGrammar {
             else {
                 Object tgt = Reflection.rebuild(buildHead(t.child(i), field.getType()), field.getType());
                 //if (tgt instanceof Object[]) tgt = Reflection.lub(tgt);
-                System.err.println("setting field " + field.getName() + " on " + c.getName() + " to " + tgt);
+                //System.err.println("setting field " + field.getName() + " on " + c.getName() + " to " + tgt);
                 try {
                     field.set(o, tgt);
                 } catch (Exception e) {
@@ -113,15 +112,15 @@ public class ReflectiveGrammar extends MetaGrammar {
         if (c==null) return null;
         if (c==int.class) return c;
         if (c==String.class) return c;
-        System.out.println("resolving " + c.getName());
+        //System.out.println("resolving " + c.getName());
         if (Reflection.isConcrete(c)) return c;
         Class ret = null;
         Class[] subs = (Class[])c.getField("subclasses").get(null);
         OUTER: for(int i=0; i<subs.length; i++) {
-            System.err.println("trying " + subs[i].getName());
+            //System.err.println("trying " + subs[i].getName());
             for(int j=0; j<t.numChildren(); j++)
                 if (Reflection.getField(subs[i], t.label(j)+"")==null) {
-                    System.err.println("skipping due to " + t.label(j));
+                    //System.err.println("skipping due to " + t.label(j));
                     continue OUTER;
                 }
             if (ret != null)
@@ -132,5 +131,5 @@ public class ReflectiveGrammar extends MetaGrammar {
         if (ret==null) throw new RuntimeException("couldn't find a class to match tree: " + t);
         return ret;
     }
-
+    */
 }