@Test public void testIncrementToken() throws Exception{ Tokenizer ts = new WhitespaceTokenizer(new StringReader("token1 token2 token3 token42")); RegExpFilter filter = new RegExpFilter(ts, "[a-z][0-9]", "REPL"); TermAttribute termAtt = (TermAttribute) filter.addAttribute(TermAttribute.class); filter.incrementToken(); assertEquals("tokeREPL", termAtt.term()); filter.incrementToken(); assertEquals("tokeREPL", termAtt.term()); filter.incrementToken(); assertEquals("tokeREPL", termAtt.term()); filter.incrementToken(); assertEquals("tokeREPL2", termAtt.term()); }
@Override public boolean incrementToken() throws IOException { if (input.incrementToken()) { String term = inputTermAtt.term(); m.reset(term); termAtt.setTermBuffer(m.replaceAll(replacement)); return true; } return false; }
RegExpFilter extends TokenFilter { @Override public boolean incrementToken() throws IOException { if (input.incrementToken()) { String term = inputTermAtt.term(); m.reset(term); termAtt.setTermBuffer(m.replaceAll(replacement)); return true; } return false; } }
RegExpFilter extends TokenFilter { @Override public boolean incrementToken() throws IOException { if (input.incrementToken()) { String term = inputTermAtt.term(); m.reset(term); termAtt.setTermBuffer(m.replaceAll(replacement)); return true; } return false; } protected  RegExpFilter(TokenStream input, String regExp, String replacement); }
RegExpFilter extends TokenFilter { @Override public boolean incrementToken() throws IOException { if (input.incrementToken()) { String term = inputTermAtt.term(); m.reset(term); termAtt.setTermBuffer(m.replaceAll(replacement)); return true; } return false; } protected  RegExpFilter(TokenStream input, String regExp, String replacement); @Override boolean incrementToken(); String getReplacement(); String getRegExp(); }
RegExpFilter extends TokenFilter { @Override public boolean incrementToken() throws IOException { if (input.incrementToken()) { String term = inputTermAtt.term(); m.reset(term); termAtt.setTermBuffer(m.replaceAll(replacement)); return true; } return false; } protected  RegExpFilter(TokenStream input, String regExp, String replacement); @Override boolean incrementToken(); String getReplacement(); String getRegExp();  }