public abstract class LookaheadTokenFilter<T extends LookaheadTokenFilter.Position> extends TokenFilter
Modifier and Type | Class and Description |
---|---|
protected static class |
LookaheadTokenFilter.Position
Holds all state for a single position; subclass this
to record other state at each position.
|
AttributeSource.State
Modifier and Type | Field and Description |
---|---|
protected boolean |
end |
protected int |
inputPos |
protected OffsetAttribute |
offsetAtt |
protected int |
outputPos |
protected PositionIncrementAttribute |
posIncAtt |
protected RollingBuffer<T> |
positions |
protected PositionLengthAttribute |
posLenAtt |
input
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
Modifier | Constructor and Description |
---|---|
protected |
LookaheadTokenFilter(TokenStream input) |
Modifier and Type | Method and Description |
---|---|
protected void |
afterPosition()
This is called when all input tokens leaving a given
position have been returned.
|
protected void |
insertToken()
Call this only from within afterPosition, to insert a new
token.
|
protected abstract T |
newPosition() |
protected boolean |
nextToken()
Call this when you are done looking ahead; it will set
the next token to return.
|
protected boolean |
peekToken()
Returns true if there is a new token.
|
void |
reset() |
close, end
incrementToken
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString
protected final PositionIncrementAttribute posIncAtt
protected final PositionLengthAttribute posLenAtt
protected final OffsetAttribute offsetAtt
protected int inputPos
protected int outputPos
protected boolean end
protected final RollingBuffer<T extends LookaheadTokenFilter.Position> positions
protected LookaheadTokenFilter(TokenStream input)
protected void insertToken() throws IOException
IOException
protected void afterPosition() throws IOException
IOException
protected abstract T newPosition()
protected boolean peekToken() throws IOException
IOException
protected boolean nextToken() throws IOException
IOException
public void reset() throws IOException
reset
in class TokenFilter
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.