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 |
inputDEFAULT_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, endincrementTokenaddAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toStringprotected 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
IOExceptionprotected void afterPosition()
throws IOException
IOExceptionprotected abstract T newPosition()
protected boolean peekToken()
throws IOException
IOExceptionprotected boolean nextToken()
throws IOException
IOExceptionpublic void reset()
throws IOException
reset in class TokenFilterIOExceptionCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.