println( "      aterm.ATermList tmp = " + getFactoryMethodName + ".getPureFactory().makeList();"); println("      for (; !reversed.isEmpty(); reversed = reversed.getTail()) {"); println("         aterm.ATerm elem = reversed.getHead().toTerm();"); println( "         tmp = " + getFactoryMethodName + ".getPureFactory().makeList(elem, tmp);");
println("      aterm.ATermList tmp = factory.makeList();"); println("for (; !reversed.isEmpty(); reversed = reversed.getTail()) {");  String head = "reversed.getHead()"; String termHead; if (!getConverter().isReserved(elementType)) { termHead = head + ".toTerm()"; } else { termHead = getConverter().makeBuiltinToATermConversion(elementType, head); } println("         aterm.ATerm elem = " + termHead + ";");  println("         tmp = factory.makeList(elem, tmp);");
    protected void genToTerm() {        String getFactoryMethodName = factoryGetter();        String className = TypeGenerator.className(type);        println("  public aterm.ATerm toTerm() {");        println("    if (this.term == null) {");        println("      " + className + " reversed = (" + className + ")this.reverse();");        println(            "      aterm.ATermList tmp = "                + getFactoryMethodName                + ".getPureFactory().makeList();");        println("      for (; !reversed.isEmpty(); reversed = reversed.getTail()) {");        println("         aterm.ATerm elem = reversed.getHead().toTerm();");        println(            "         tmp = "                + getFactoryMethodName                + ".getPureFactory().makeList(elem, tmp);");        println("      }");        println("      this.term = tmp;");        println("    }");        println("    return this.term;");        println("  }");        println();    }