println("      args.add(this." + field_name + ");");
String field_type = field.getType(); if (field_type.equals("int")) { println("      args.add(new Integer(this." + field_name + "));"); } else if (field_type.equals("real")) { println("      args.add(new Double(this." + field_name + "));"); } else { println("      args.add(this." + field_name + ");"); }
  private void genAltToTerm(Type type, Alternative alt)  {    String decl = "public aterm.ATerm toTerm(aterm.ATermFactory factory)";    printFoldOpen(decl);    println("  " + decl);    println("  {");    println("    if (super.term == null) {");    println("      List args = new LinkedList();");    Iterator iter = type.altFieldIterator(alt.getId());    while (iter.hasNext()) {      Field field = (Field)iter.next();      String field_name = buildFieldId(field.getId());      println("      args.add(this." + field_name + ");");    }    println();    String alt_id = buildId(alt.getId());    println("      super.term = factory.make(pat" + alt_id + ", args);");     println("      return super.term;");    println("    }");    println();    println("    if (term.getFactory() == factory || factory == null) {");    println("      return super.term;");    println("    } else {");    println("      return factory.importTerm(super.term);");    println("    }");    println("  }");    printFoldClose();  }