String paramTypeName = TypeGenerator.qualifiedClassName(getJavaGenerationParameters(), type); String manyPattern = patternListVariable(type);
String paramTypeName = TypeGenerator.qualifiedClassName(getJavaGenerationParameters(), type); String manyPattern = patternListVariable(type); String elementType = type.getElementType();
	private void genFactorySeparatedListToTerm(SeparatedListType type) {		String paramTypeName = TypeGenerator.qualifiedClassName(getJavaGenerationParameters(), type);		String manyPattern = patternListVariable(type);		println("  public aterm.ATerm toTerm(" + paramTypeName + " arg) {");		println("    if (arg.isEmpty()) {");		println("      return factory.getEmpty();");		println("    }");		println();		println("    if (arg.isSingle()) {");		println("      return factory.makeList(arg.getHead().toTerm());");		println("    }");		println();		println("    int length = arg.getLength();");		println("    " + paramTypeName + "[] nodes = new " + paramTypeName + "[length];");		println();		println("    for (int i = 0; i < length; i++) {");		println("      nodes[length-i-1] = arg;");		println("      arg = arg.getTail();");		println("    }");		println();		println("    aterm.ATermList result = factory.makeList(nodes[0].getHead().toTerm());");		println("    for (int i = 1; i < length; i++) {");		println("      java.util.List args = new java.util.LinkedList();");		println("      args.add(nodes[i].getHead().toTerm());");		Iterator separators = type.separatorFieldIterator();		while (separators.hasNext()) {			Field separator = (Field) separators.next();			String fieldId = separator.getId();			String capitalizedFieldId = StringConversions.makeCapitalizedIdentifier(fieldId);			String fieldGetter = "get" + capitalizedFieldId + "()";			println("      args.add(nodes[i]." + fieldGetter + ".toTerm());");		}		println("      args.add(result);");		println("      result = (aterm.ATermList) " + manyPattern + ".make(args);");		println("    }");		println();		println("    return result;");		println("  }");		println();	}