public class OrderPreservingFilteredIterator extends Object implements Iterator<String>
TokenFilter
to remove invalid tokens and replaces them with the IteratorFactory.EMPTY_TOKEN
string to signify their position. This class is
itended for us when filtering is desired but the original ordering and
spacing of the tokens must be preserved.Constructor and Description |
---|
OrderPreservingFilteredIterator(BufferedReader reader,
TokenFilter filter)
Creates a filtered iterator using the reader as a source of tokens
|
OrderPreservingFilteredIterator(Iterator<String> tokens,
TokenFilter filter)
Creates a filtered iterator using provided iterator as the source of
tokens
|
OrderPreservingFilteredIterator(String str,
TokenFilter filter)
Creates a filtered iterator using the string as a source of tokens
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext()
Returns
true if this iterator has additional tokens that would be
accepted by the filter |
String |
next()
Returns the next word from the reader that has passed the filter.
|
void |
remove()
Throws an
UnsupportedOperationException if called. |
public OrderPreservingFilteredIterator(String str, TokenFilter filter)
public OrderPreservingFilteredIterator(BufferedReader reader, TokenFilter filter)
public OrderPreservingFilteredIterator(Iterator<String> tokens, TokenFilter filter)
public boolean hasNext()
true
if this iterator has additional tokens that would be
accepted by the filterpublic String next()
public void remove()
UnsupportedOperationException
if called.Copyright © 2012. All Rights Reserved.