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[]
boolean
Determines whether the text filter includes the specified textvoid
setDotAll
(boolean dotAll) Sets the dot-all state for ALL filter elementsvoid
setElements
(String elementsStr) void
setElements
(String[] elements) void
setElements
(List<TextFilterElement> elements) void
setIgnoreCase
(boolean ignoreCase) Sets the ignore case state for ALL filter elementsvoid
setIgnoreWhitespace
(boolean ignoreWhitespace) Sets the ignore whitespace state for ALL filter elementsvoid
setMultiLine
(boolean multiLine) Sets the multi-line state for ALL filter elementsvoid
setUsesRegex
(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:
usesRegex
in interfaceITextFilter
- Returns:
- whether the filter uses regular expression matching
-
setUsesRegex
public void setUsesRegex(boolean usesRegex) - Specified by:
setUsesRegex
in interfaceITextFilter
- Parameters:
usesRegex
- specifies whether the filter uses regular expression matching
-
getElements
- Specified by:
getElements
in interfaceITextFilter
- Returns:
- a copy of the filter elements
-
getElementStrings
- Specified by:
getElementStrings
in interfaceITextFilter
- Returns:
- a copy of the filter elements as individual strings
-
getNormalizedElementStrings
- Specified by:
getNormalizedElementStrings
in interfaceITextFilter
- Returns:
- a copy of the filter elements as individual strings, with common flags removed
-
getElementsString
- Specified by:
getElementsString
in interfaceITextFilter
- Returns:
- a copy of the filter elements as a single multi-line string
-
getNormalizedElementsString
- Specified by:
getNormalizedElementsString
in interfaceITextFilter
- Returns:
- a copy of the filter elements as a single multi-line string, each line having common flags removed
-
setElements
- Specified by:
setElements
in interfaceITextFilter
- Parameters:
elements
- the filter elements to set
-
setElements
- Specified by:
setElements
in interfaceITextFilter
- Parameters:
elements
- the filter elements to set- Throws:
TextFilterException
-
setElements
- Specified by:
setElements
in 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:ITextFilter
Sets the multi-line state for ALL filter elements- Specified by:
setMultiLine
in interfaceITextFilter
- Parameters:
multiLine
- specifies whether the filter element can match multiple lines (regex only)
-
setDotAll
public void setDotAll(boolean dotAll) Description copied from interface:ITextFilter
Sets the dot-all state for ALL filter elements- Specified by:
setDotAll
in 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:ITextFilter
Sets the ignore whitespace state for ALL filter elements- Specified by:
setIgnoreWhitespace
in interfaceITextFilter
- Parameters:
ignoreWhitespace
- specifies whether whitespace in the pattern is ignored (regex only)
-
setIgnoreCase
public void setIgnoreCase(boolean ignoreCase) Description copied from interface:ITextFilter
Sets the ignore case state for ALL filter elements- Specified by:
setIgnoreCase
in interfaceITextFilter
- Parameters:
ignoreCase
- specifies whether the filter element uses case insensitive matching
-
includes
Description copied from interface:ITextFilter
Determines whether the text filter includes the specified text- Specified by:
includes
in 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:ITextFilter
Filters an array of strings into subsets that are included and excluded by the filter- Specified by:
filter
in 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:ITextFilter
Filters an array of strings into subsets that are included and excluded by the filter- Specified by:
filter
in 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:ITextFilter
Filters an array of strings and returns the subset included by the filter- Specified by:
getIncluded
in 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:ITextFilter
Filters an array of strings and returns the subset included by the filter- Specified by:
getIncluded
in 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:ITextFilter
Filters an array of strings and returns the subset excluded by the filter- Specified by:
getExcluded
in 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:ITextFilter
Filters an array of strings and returns the subset excluded by the filter- Specified by:
getExcluded
in interfaceITextFilter
- Parameters:
text
- the array of strings to filter- Returns:
- the subset of strings excluded by the filter
- Throws:
TextFilterException
-
getFlags
- Specified by:
getFlags
in interfaceITextFilter
- Returns:
- the set of flags set on all elements
-