package org.spoofax.interpreter.terms;

public class InlinePrinter implements ITermPrinter {
	StringBuffer out;
	
	public InlinePrinter() {
		out = new StringBuffer();
	}
	
	public String getString() {
		return out.toString();
	}

	public void print(String string) {
		if (string.matches("^ *$")) {
			return ;
		}
		out.append(string);
	}

	public void indent(int i) {
	}

	public void nextIndentOff() {
	}

	public void outdent(int i) {
	}

	public void println(String string, boolean b) {
		if (string.matches("^ *$")) {
			return ;
		}
		out.append(string);
	}

	public void println(String string) {
		out.append(string);
	}
}

package org.spoofax.interpreter.terms;

public class InlinePrinter implements ITermPrinter {
	String out;
	
	public InlinePrinter() {
		out = "";
	}
	
	public String getString() {
		return out;
	}

	public void print(String string) {
		if (string.matches("^ *$")) {
			return ;
		}
		out += string;
	}

	public void indent(int i) {
	}

	public void nextIndentOff() {
	}

	public void outdent(int i) {
	}

	public void println(String string, boolean b) {
		if (string.matches("^ *$")) {
			return ;
		}
		out += string;
	}

	public void println(String string) {
		out += string;
	}
}

--- 
+++ 
@@ -1,21 +1,21 @@
 package org.spoofax.interpreter.terms;
 
 public class InlinePrinter implements ITermPrinter {
-	String out;
+	StringBuffer out;
 	
 	public InlinePrinter() {
-		out = "";
+		out = new StringBuffer();
 	}
 	
 	public String getString() {
-		return out;
+		return out.toString();
 	}
 
 	public void print(String string) {
 		if (string.matches("^ *$")) {
 			return ;
 		}
-		out += string;
+		out.append(string);
 	}
 
 	public void indent(int i) {
@@ -31,10 +31,10 @@
 		if (string.matches("^ *$")) {
 			return ;
 		}
-		out += string;
+		out.append(string);
 	}
 
 	public void println(String string) {
-		out += string;
+		out.append(string);
 	}
 }
Use StringBuffer to avoid string concatenation while inline printing.

svn path=/spoofax/trunk/spoofax/org.spoofax.interpreter/; revision=17214
