public abstract class LookaheadTokenFilter<T extends LookaheadTokenFilter.Position>
extends org.apache.lucene.analysis.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.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
end |
protected int |
inputPos |
protected org.apache.lucene.analysis.tokenattributes.OffsetAttribute |
offsetAtt |
protected int |
outputPos |
protected org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute |
posIncAtt |
protected RollingBuffer<T> |
positions |
protected org.apache.lucene.analysis.tokenattributes.PositionLengthAttribute |
posLenAtt |
Modifier | Constructor and Description |
---|---|
protected |
LookaheadTokenFilter(org.apache.lucene.analysis.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() |
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, restoreState, toString
protected final org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute posIncAtt
protected final org.apache.lucene.analysis.tokenattributes.PositionLengthAttribute posLenAtt
protected final org.apache.lucene.analysis.tokenattributes.OffsetAttribute offsetAtt
protected int inputPos
protected int outputPos
protected boolean end
protected final RollingBuffer<T extends LookaheadTokenFilter.Position> positions
protected LookaheadTokenFilter(org.apache.lucene.analysis.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 org.apache.lucene.analysis.TokenFilter
IOException