// These end up inside the main class static class LFixWhitespace extends LearnerImpl { static boolean debug; Learner base; String s; *(Learner *base) {} public void tryAgain() { base.tryAgain(); } public void processInOut(Object _in, Object _out) { String in = (String) _in, out = (String) _out; int i = count(in), j = count(out); in = in.substring(i); s = out.substring(0, j); out = out.substring(j); if (debug) System.out.println("LFixWhitespace: Feeding to input learner: " + in + " => " + out); base.processInOut(in, out); } public Object processIn(Object _in) { String in = (String) _in; int i = count(in); in = in.substring(i); in = (String) base.processIn(in); in = s + in; return in; } int count(String s) { int I = 0; while (I < s.length () && "\r\n\t ".indexOf(s.charAt(I)) >= 0) ++I; return I; } }