package plagiarism.filter;

import java.io.FilterReader;
import java.io.IOException;
import java.io.Reader;

/**
 * Read a single character and apply the filter criteria.
 *
 * <p>Special characters will be discarded and replaced by whitespaces, digits will be left
 * unchanged and letters will be converted to lower case.
 *
 * @author Hendrik Brinkmann
 */
public class CharacterFilter extends FilterReader {

  public CharacterFilter(final Reader in) {
    super(in);
  }

  @Override
  public int read() throws IOException {
    final int c = in.read();
    if (c == -1) return -1;
    if (Character.isLetterOrDigit(c)) return Character.toLowerCase(c);
    return ' ';
  }
}

@@ -21,16 +21,115 @@
 ilter;%0A%0A
+import static java.lang.Character.isLetterOrDigit;%0Aimport static java.lang.Character.toLowerCase;%0A%0A
 import j
@@ -687,26 +687,16 @@
     if (
-Character.
 isLetter
@@ -714,26 +714,16 @@
  return 
-Character.
 toLowerC

optimize imports