public abstract class ConditionalTokenFilter extends TokenFilter
shouldFilter() method. If it returns true,
then calling incrementToken() will use the wrapped TokenFilter(s) to
make changes to the tokenstream. If it returns false, then the wrapped
filter(s) will be skipped.AttributeSource.StateinputDEFAULT_TOKEN_ATTRIBUTE_FACTORY| Modifier | Constructor and Description |
|---|---|
protected |
ConditionalTokenFilter(TokenStream input,
Function<TokenStream,TokenStream> inputFactory)
Create a new ConditionalTokenFilter
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
end() |
boolean |
incrementToken() |
void |
reset() |
protected abstract boolean |
shouldFilter()
Whether or not to execute the wrapped TokenFilter(s) for the current token
|
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toStringprotected ConditionalTokenFilter(TokenStream input, Function<TokenStream,TokenStream> inputFactory)
input - the input TokenStreaminputFactory - a factory function to create the wrapped filter(s)protected abstract boolean shouldFilter()
throws IOException
IOExceptionpublic void reset()
throws IOException
reset in class TokenFilterIOExceptionpublic void end()
throws IOException
end in class TokenFilterIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class TokenFilterIOExceptionpublic final boolean incrementToken()
throws IOException
incrementToken in class TokenStreamIOExceptionCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.