public class WordFilter extends DataFilter
Constructor and Description |
---|
WordFilter(java.lang.String fieldName)
Instantiates a new WordFilter with the specified field.
|
WordFilter(java.lang.String fieldName,
java.util.Set<java.lang.String> words)
Instantiates a new WordFilter with the specified field and set of match
words.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(DataRecord record)
Return whether the filter accepts the data record.
|
void |
addTerm(java.lang.String word)
Add a word to the set of match words for this filter
|
void |
addTerms(java.util.Set<java.lang.String> words)
Add words to the set of match words for this filter
|
java.util.Set<java.lang.String> |
getMatchWords()
Return the current set of words to search for
|
void |
setMatchAll(boolean flag)
Set the matchAll flag.
|
filterRecords
public WordFilter(java.lang.String fieldName)
addTerm
or
addTerms
.fieldName
- the field namepublic WordFilter(java.lang.String fieldName, java.util.Set<java.lang.String> words)
fieldName
- the field namewords
- the set of words to matchpublic boolean accept(DataRecord record)
accept
in class DataFilter
record
- the recordpublic void addTerm(java.lang.String word)
word
- the new word to matchpublic void addTerms(java.util.Set<java.lang.String> words)
words
- the set of additional words to matchpublic java.util.Set<java.lang.String> getMatchWords()
public void setMatchAll(boolean flag)
flag
- true if all words should be matched, false otherwise