org.apache.lucene.analysis
Class ReusableAnalyzerBase.TokenStreamComponents

java.lang.Object
  extended by org.apache.lucene.analysis.ReusableAnalyzerBase.TokenStreamComponents
Enclosing class:
ReusableAnalyzerBase

public static class ReusableAnalyzerBase.TokenStreamComponents
extends Object

This class encapsulates the outer components of a token stream. It provides access to the source (Tokenizer) and the outer end (sink), an instance of TokenFilter which also serves as the TokenStream returned by Analyzer.tokenStream(String, Reader) and Analyzer.reusableTokenStream(String, Reader).


Field Summary
protected  TokenStream sink
           
protected  Tokenizer source
           
 
Constructor Summary
ReusableAnalyzerBase.TokenStreamComponents(Tokenizer source)
          Creates a new ReusableAnalyzerBase.TokenStreamComponents instance.
ReusableAnalyzerBase.TokenStreamComponents(Tokenizer source, TokenStream result)
          Creates a new ReusableAnalyzerBase.TokenStreamComponents instance.
 
Method Summary
protected  TokenStream getTokenStream()
          Returns the sink TokenStream
protected  boolean reset(Reader reader)
          Resets the encapsulated components with the given reader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

protected final Tokenizer source

sink

protected final TokenStream sink
Constructor Detail

ReusableAnalyzerBase.TokenStreamComponents

public ReusableAnalyzerBase.TokenStreamComponents(Tokenizer source,
                                                  TokenStream result)
Creates a new ReusableAnalyzerBase.TokenStreamComponents instance.

Parameters:
source - the analyzer's tokenizer
result - the analyzer's resulting token stream

ReusableAnalyzerBase.TokenStreamComponents

public ReusableAnalyzerBase.TokenStreamComponents(Tokenizer source)
Creates a new ReusableAnalyzerBase.TokenStreamComponents instance.

Parameters:
source - the analyzer's tokenizer
Method Detail

reset

protected boolean reset(Reader reader)
                 throws IOException
Resets the encapsulated components with the given reader. This method by default returns true indicating that the components have been reset successfully. Subclasses of ReusableAnalyzerBase might use their own ReusableAnalyzerBase.TokenStreamComponents returning false if the components cannot be reset.

Parameters:
reader - a reader to reset the source component
Returns:
true if the components were reset, otherwise false
Throws:
IOException - if the component's reset method throws an IOException

getTokenStream

protected TokenStream getTokenStream()
Returns the sink TokenStream

Returns:
the sink TokenStream