else if (field_type.equals("term")) { print("(aterm.ATerm) children.get(" + argnr + ")"); }
  private void genAltFromTerm(Type type, Alternative alt)  {    String class_name = buildClassName(type);    String alt_class_name = buildAltClassName(type, alt);    Iterator fields;    int argnr;       printFoldOpen("fromTerm(ATerm trm)");     println("  static public " + class_name + " fromTerm(aterm.ATerm trm)");    println("  {");    println("    java.util.List children = trm.match(pattern);");        println("    if (children != null) {");        print  ("      " + class_name + " tmp = getStatic" + api_factory +             "().make" + alt_class_name + "(");    fields = type.altFieldIterator(alt.getId());    argnr = 0;                while (fields.hasNext()) {      Field field = (Field) fields.next();      String field_type = field.getType();            if (field_type.equals("str")) {        print("(String) children.get(" + argnr + ")");      }      else if (field_type.equals("int")) {        print("(Integer) children.get(" + argnr + ")");      }      else if (field_type.equals("real")) {        print("(Double) children.get(" + argnr + ")");      }      else {        print(field_type + ".fromTerm( (aterm.ATerm) children.get(" + argnr + "))");      }            if (fields.hasNext()) {        print(", ");      }      argnr++;    }    println(");");    println("      tmp.setTerm(trm);");    println("      return tmp;");    println("    }"); // endif          println("    else {");    println("      return null;");    println("    }");    println("  }");    printFoldClose();  }