println("    this." + field_name + " = (" + field_type + ")iter.next();");
if (field_type.equals("int")) { println("    this." + field_name + " = ((Integer)iter.next()).intValue();"); } else if (field_type.equals("real")) { println("    this." + field_name + " = ((Double)iter.next()).doubleValue();"); } else { println("    this." + field_name + " = (" + field_type + ")iter.next();"); }
  private void genAltConstructors(Type type, Alternative alt)  {    String alt_class = buildAltClassName(type, alt);    String decl = alt_class + "(aterm.ATerm term, List args)";    printFoldOpen(decl);    println("  " + decl);    println("  {");    println("    super(term);");    println();    println("    Iterator iter = args.iterator();");    Iterator fields = type.altFieldIterator(alt.getId());    while (fields.hasNext()) {      Field field = (Field)fields.next();      String field_name = buildFieldId(field.getId());      String field_type = buildTypeId(field.getType());      println("    this." + field_name + " = (" + field_type + ")iter.next();");    }    println("    if (iter.hasNext()) {");    println("      throw new RuntimeException(\"too many elements?\");");    println("    }");    println("  }");    printFoldClose();    decl = alt_class + "(" + buildAltFormals(type, alt) + ")";    printFoldOpen(decl);    println("  " + decl);    println("  {");    println("    super(null);");    println();    fields = type.altFieldIterator(alt.getId());    while (fields.hasNext()) {      Field field = (Field)fields.next();      String field_name = buildFieldId(field.getId());      println("    this." + field_name + " = " + field_name + ";");    }    println("  }");    printFoldClose();    println();  }