Class TextFilter

java.lang.Object
hec.data.textFilter.TextFilter
All Implemented Interfaces:
ITextFilter

public class TextFilter extends Object implements ITextFilter
  • Constructor Details

    • TextFilter

      public TextFilter(boolean usesRegex, List<TextFilterElement> elements)
      Constructor from element list
      Parameters:
      usesRegex - specifies whether the filter uses regular expression matching
      elements - the filter elements
    • TextFilter

      public TextFilter(boolean usesRegex, String[] elements) throws TextFilterException
      Constructor from text array
      Parameters:
      usesRegex - specifies whether the filter uses regular expression matching
      elements - the filter elements as individual text filter element representations
      Throws:
      TextFilterException
    • TextFilter

      public TextFilter(boolean usesRegex, String elementsStr) throws TextFilterException
      Constructor from text
      Parameters:
      usesRegex - specifies whether the filter uses regular expression matching
      elementsStr - 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 interface ITextFilter
      Returns:
      whether the filter uses regular expression matching
    • setUsesRegex

      public void setUsesRegex(boolean usesRegex)
      Specified by:
      setUsesRegex in interface ITextFilter
      Parameters:
      usesRegex - specifies whether the filter uses regular expression matching
    • getElements

      public List<TextFilterElement> getElements()
      Specified by:
      getElements in interface ITextFilter
      Returns:
      a copy of the filter elements
    • getElementStrings

      public String[] getElementStrings()
      Specified by:
      getElementStrings in interface ITextFilter
      Returns:
      a copy of the filter elements as individual strings
    • getNormalizedElementStrings

      public String[] getNormalizedElementStrings()
      Specified by:
      getNormalizedElementStrings in interface ITextFilter
      Returns:
      a copy of the filter elements as individual strings, with common flags removed
    • getElementsString

      public String getElementsString()
      Specified by:
      getElementsString in interface ITextFilter
      Returns:
      a copy of the filter elements as a single multi-line string
    • getNormalizedElementsString

      public String getNormalizedElementsString()
      Specified by:
      getNormalizedElementsString in interface ITextFilter
      Returns:
      a copy of the filter elements as a single multi-line string, each line having common flags removed
    • setElements

      public void setElements(List<TextFilterElement> elements)
      Specified by:
      setElements in interface ITextFilter
      Parameters:
      elements - the filter elements to set
    • setElements

      public void setElements(String[] elements) throws TextFilterException
      Specified by:
      setElements in interface ITextFilter
      Parameters:
      elements - the filter elements to set
      Throws:
      TextFilterException
    • setElements

      public void setElements(String elementsStr) throws TextFilterException
      Specified by:
      setElements in interface ITextFilter
      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 interface ITextFilter
      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 interface ITextFilter
      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 interface ITextFilter
      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 interface ITextFilter
      Parameters:
      ignoreCase - specifies whether the filter element uses case insensitive matching
    • includes

      public boolean includes(String text) throws TextFilterException
      Description copied from interface: ITextFilter
      Determines whether the text filter includes the specified text
      Specified by:
      includes in interface ITextFilter
      Parameters:
      text - the text to pass through the filter
      Returns:
      whether the text filter includes the specified text
      Throws:
      TextFilterException
    • filter

      public String[][] filter(String[] text) throws TextFilterException
      Description copied from interface: ITextFilter
      Filters an array of strings into subsets that are included and excluded by the filter
      Specified by:
      filter in interface ITextFilter
      Parameters:
      text - the array of strings to filter
      Returns:
      a couple comprising the filtered subsets in the order included, excluded
      Throws:
      TextFilterException
    • filter

      public String[][] filter(Iterable<String> text) throws TextFilterException
      Description copied from interface: ITextFilter
      Filters an array of strings into subsets that are included and excluded by the filter
      Specified by:
      filter in interface ITextFilter
      Parameters:
      text - the array of strings to filter
      Returns:
      a couple comprising the filtered subsets in the order included, excluded
      Throws:
      TextFilterException
    • getIncluded

      public String[] getIncluded(String[] text) throws TextFilterException
      Description copied from interface: ITextFilter
      Filters an array of strings and returns the subset included by the filter
      Specified by:
      getIncluded in interface ITextFilter
      Parameters:
      text - the array of strings to filter
      Returns:
      the subset of strings included by the filter
      Throws:
      TextFilterException
    • getIncluded

      public String[] getIncluded(Iterable<String> text) throws TextFilterException
      Description copied from interface: ITextFilter
      Filters an array of strings and returns the subset included by the filter
      Specified by:
      getIncluded in interface ITextFilter
      Parameters:
      text - the array of strings to filter
      Returns:
      the subset of strings included by the filter
      Throws:
      TextFilterException
    • getExcluded

      public String[] getExcluded(String[] text) throws TextFilterException
      Description copied from interface: ITextFilter
      Filters an array of strings and returns the subset excluded by the filter
      Specified by:
      getExcluded in interface ITextFilter
      Parameters:
      text - the array of strings to filter
      Returns:
      the subset of strings excluded by the filter
      Throws:
      TextFilterException
    • getExcluded

      public String[] getExcluded(Iterable<String> text) throws TextFilterException
      Description copied from interface: ITextFilter
      Filters an array of strings and returns the subset excluded by the filter
      Specified by:
      getExcluded in interface ITextFilter
      Parameters:
      text - the array of strings to filter
      Returns:
      the subset of strings excluded by the filter
      Throws:
      TextFilterException
    • getFlags

      public String getFlags()
      Specified by:
      getFlags in interface ITextFilter
      Returns:
      the set of flags set on all elements