Package org.apache.lucene.tests.analysis
Class MockRandomLookaheadTokenFilter
- java.lang.Object
-
- org.apache.lucene.util.AttributeSource
-
- org.apache.lucene.analysis.TokenStream
-
- org.apache.lucene.analysis.TokenFilter
-
- org.apache.lucene.tests.analysis.LookaheadTokenFilter<LookaheadTokenFilter.Position>
-
- org.apache.lucene.tests.analysis.MockRandomLookaheadTokenFilter
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Unwrappable<TokenStream>
public final class MockRandomLookaheadTokenFilter extends LookaheadTokenFilter<LookaheadTokenFilter.Position>
UsesLookaheadTokenFilterto randomly peek at future tokens.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.tests.analysis.LookaheadTokenFilter
LookaheadTokenFilter.Position
-
Nested classes/interfaces inherited from class org.apache.lucene.util.AttributeSource
AttributeSource.State
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.tests.analysis.LookaheadTokenFilter
end, inputPos, offsetAtt, outputPos, posIncAtt, positions, posLenAtt
-
Fields inherited from class org.apache.lucene.analysis.TokenFilter
input
-
Fields inherited from class org.apache.lucene.analysis.TokenStream
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
-
-
Constructor Summary
Constructors Constructor Description MockRandomLookaheadTokenFilter(Random random, TokenStream in)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterPosition()This is called when all input tokens leaving a given position have been returned.booleanincrementToken()LookaheadTokenFilter.PositionnewPosition()voidreset()-
Methods inherited from class org.apache.lucene.tests.analysis.LookaheadTokenFilter
insertToken, nextToken, peekToken
-
Methods inherited from class org.apache.lucene.analysis.TokenFilter
close, end, unwrap
-
Methods inherited from class org.apache.lucene.util.AttributeSource
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString
-
-
-
-
Constructor Detail
-
MockRandomLookaheadTokenFilter
public MockRandomLookaheadTokenFilter(Random random, TokenStream in)
-
-
Method Detail
-
newPosition
public LookaheadTokenFilter.Position newPosition()
- Specified by:
newPositionin classLookaheadTokenFilter<LookaheadTokenFilter.Position>
-
afterPosition
protected void afterPosition() throws IOExceptionDescription copied from class:LookaheadTokenFilterThis is called when all input tokens leaving a given position have been returned. Override this and call insertToken and then set whichever token's attributes you want, if you want to inject a token starting from this position.- Overrides:
afterPositionin classLookaheadTokenFilter<LookaheadTokenFilter.Position>- Throws:
IOException
-
incrementToken
public boolean incrementToken() throws IOException- Specified by:
incrementTokenin classTokenStream- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classLookaheadTokenFilter<LookaheadTokenFilter.Position>- Throws:
IOException
-
-