Package hec.data.textFilter
Class TextFilter
java.lang.Object
hec.data.textFilter.TextFilter
- All Implemented Interfaces:
ITextFilter
-
Field Summary
Fields inherited from interface hec.data.ITextFilter
EXCLUDED, INCLUDED -
Constructor Summary
ConstructorsConstructorDescriptionTextFilter(boolean usesRegex, String elementsStr) Constructor from textTextFilter(boolean usesRegex, String[] elements) Constructor from text arrayTextFilter(boolean usesRegex, List<TextFilterElement> elements) Constructor from element list -
Method Summary
Modifier and TypeMethodDescriptionString[][]Filters an array of strings into subsets that are included and excluded by the filterString[][]Filters an array of strings into subsets that are included and excluded by the filterString[]String[]getExcluded(Iterable<String> text) Filters an array of strings and returns the subset excluded by the filterString[]getExcluded(String[] text) Filters an array of strings and returns the subset excluded by the filtergetFlags()String[]getIncluded(Iterable<String> text) Filters an array of strings and returns the subset included by the filterString[]getIncluded(String[] text) Filters an array of strings and returns the subset included by the filterString[]booleanDetermines whether the text filter includes the specified textvoidsetDotAll(boolean dotAll) Sets the dot-all state for ALL filter elementsvoidsetElements(String elementsStr) voidsetElements(String[] elements) voidsetElements(List<TextFilterElement> elements) voidsetIgnoreCase(boolean ignoreCase) Sets the ignore case state for ALL filter elementsvoidsetIgnoreWhitespace(boolean ignoreWhitespace) Sets the ignore whitespace state for ALL filter elementsvoidsetMultiLine(boolean multiLine) Sets the multi-line state for ALL filter elementsvoidsetUsesRegex(boolean usesRegex) boolean
-
Constructor Details
-
TextFilter
Constructor from element list- Parameters:
usesRegex- specifies whether the filter uses regular expression matchingelements- the filter elements
-
TextFilter
Constructor from text array- Parameters:
usesRegex- specifies whether the filter uses regular expression matchingelements- the filter elements as individual text filter element representations- Throws:
TextFilterException
-
TextFilter
Constructor from text- Parameters:
usesRegex- specifies whether the filter uses regular expression matchingelementsStr- the filter elements as a multi-line string of filter element text representations- Throws:
TextFilterException
-
-
Method Details
-
usesRegex
public boolean usesRegex()- Specified by:
usesRegexin interfaceITextFilter- Returns:
- whether the filter uses regular expression matching
-
setUsesRegex
public void setUsesRegex(boolean usesRegex) - Specified by:
setUsesRegexin interfaceITextFilter- Parameters:
usesRegex- specifies whether the filter uses regular expression matching
-
getElements
- Specified by:
getElementsin interfaceITextFilter- Returns:
- a copy of the filter elements
-
getElementStrings
- Specified by:
getElementStringsin interfaceITextFilter- Returns:
- a copy of the filter elements as individual strings
-
getNormalizedElementStrings
- Specified by:
getNormalizedElementStringsin interfaceITextFilter- Returns:
- a copy of the filter elements as individual strings, with common flags removed
-
getElementsString
- Specified by:
getElementsStringin interfaceITextFilter- Returns:
- a copy of the filter elements as a single multi-line string
-
getNormalizedElementsString
- Specified by:
getNormalizedElementsStringin interfaceITextFilter- Returns:
- a copy of the filter elements as a single multi-line string, each line having common flags removed
-
setElements
- Specified by:
setElementsin interfaceITextFilter- Parameters:
elements- the filter elements to set
-
setElements
- Specified by:
setElementsin interfaceITextFilter- Parameters:
elements- the filter elements to set- Throws:
TextFilterException
-
setElements
- Specified by:
setElementsin interfaceITextFilter- Parameters:
elementsStr- the filter elements to set in a single multi-line string- Throws:
TextFilterException
-
setMultiLine
public void setMultiLine(boolean multiLine) Description copied from interface:ITextFilterSets the multi-line state for ALL filter elements- Specified by:
setMultiLinein interfaceITextFilter- Parameters:
multiLine- specifies whether the filter element can match multiple lines (regex only)
-
setDotAll
public void setDotAll(boolean dotAll) Description copied from interface:ITextFilterSets the dot-all state for ALL filter elements- Specified by:
setDotAllin interfaceITextFilter- Parameters:
dotAll- specifies whether the dot '.' pattern character can match a newline character (regex only)
-
setIgnoreWhitespace
public void setIgnoreWhitespace(boolean ignoreWhitespace) Description copied from interface:ITextFilterSets the ignore whitespace state for ALL filter elements- Specified by:
setIgnoreWhitespacein interfaceITextFilter- Parameters:
ignoreWhitespace- specifies whether whitespace in the pattern is ignored (regex only)
-
setIgnoreCase
public void setIgnoreCase(boolean ignoreCase) Description copied from interface:ITextFilterSets the ignore case state for ALL filter elements- Specified by:
setIgnoreCasein interfaceITextFilter- Parameters:
ignoreCase- specifies whether the filter element uses case insensitive matching
-
includes
Description copied from interface:ITextFilterDetermines whether the text filter includes the specified text- Specified by:
includesin interfaceITextFilter- Parameters:
text- the text to pass through the filter- Returns:
- whether the text filter includes the specified text
- Throws:
TextFilterException
-
filter
Description copied from interface:ITextFilterFilters an array of strings into subsets that are included and excluded by the filter- Specified by:
filterin interfaceITextFilter- Parameters:
text- the array of strings to filter- Returns:
- a couple comprising the filtered subsets in the order included, excluded
- Throws:
TextFilterException
-
filter
Description copied from interface:ITextFilterFilters an array of strings into subsets that are included and excluded by the filter- Specified by:
filterin interfaceITextFilter- Parameters:
text- the array of strings to filter- Returns:
- a couple comprising the filtered subsets in the order included, excluded
- Throws:
TextFilterException
-
getIncluded
Description copied from interface:ITextFilterFilters an array of strings and returns the subset included by the filter- Specified by:
getIncludedin interfaceITextFilter- Parameters:
text- the array of strings to filter- Returns:
- the subset of strings included by the filter
- Throws:
TextFilterException
-
getIncluded
Description copied from interface:ITextFilterFilters an array of strings and returns the subset included by the filter- Specified by:
getIncludedin interfaceITextFilter- Parameters:
text- the array of strings to filter- Returns:
- the subset of strings included by the filter
- Throws:
TextFilterException
-
getExcluded
Description copied from interface:ITextFilterFilters an array of strings and returns the subset excluded by the filter- Specified by:
getExcludedin interfaceITextFilter- Parameters:
text- the array of strings to filter- Returns:
- the subset of strings excluded by the filter
- Throws:
TextFilterException
-
getExcluded
Description copied from interface:ITextFilterFilters an array of strings and returns the subset excluded by the filter- Specified by:
getExcludedin interfaceITextFilter- Parameters:
text- the array of strings to filter- Returns:
- the subset of strings excluded by the filter
- Throws:
TextFilterException
-
getFlags
- Specified by:
getFlagsin interfaceITextFilter- Returns:
- the set of flags set on all elements
-