org.pf.tools.cda.base.model.util
Class StringFilter

java.lang.Object
  extended by org.pf.text.AStringFilter
      extended by org.pf.text.StringPattern
          extended by org.pf.tools.cda.base.model.util.StringFilter
All Implemented Interfaces:
java.io.Serializable, org.pf.bif.filter.IObjectFilter<java.lang.String>, org.pf.bif.text.IJSONConvertible, org.pf.text.StringFilter

public class StringFilter
extends org.pf.text.StringPattern

This filter extends StringPattern with the possibility to activate/deactivate it. That is, a deactivated filter never matches anything.

Version:
1.2
Author:
Manfred Duchrow
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.pf.bif.text.IJSONConvertible
JSON_ARRAY_END, JSON_ARRAY_START, JSON_ELEMENT_SEPARATOR, JSON_LITERAL_FALSE, JSON_LITERAL_NULL, JSON_LITERAL_TRUE, JSON_OBJECT_END, JSON_OBJECT_START, JSON_PAIR_SEPARATOR, JSON_STRING_DELIMITER, JSON_STRING_ESCAPE
 
Fields inherited from interface org.pf.text.StringFilter
ALL, NONE
 
Constructor Summary
StringFilter(java.lang.String pattern)
          Initializes the new instance with the string pattern.
StringFilter(java.lang.String pattern, boolean ignoreCase)
          Initializes the new instance with the string pattern and the selecteion, if case should be ignored when comparing characters.
StringFilter(java.lang.String pattern, boolean ignoreCase, boolean active)
          Initializes the new instance with the string pattern and the selecteion, if case should be ignored when comparing characters.
StringFilter(java.lang.String pattern, boolean ignoreCase, char digitWildcard)
          Initializes the new instance with the string pattern and the selecteion, if case should be ignored when comparing characters plus a wildcard character for digits.
StringFilter(java.lang.String pattern, char digitWildcard)
          Initializes the new instance with the string pattern and a digit wildcard character.
 
Method Summary
 void appendToBuffer(java.lang.StringBuffer buffer)
          Append this filter's string representation to the given buffer.
 StringFilter copy()
          Returns a new object that is an exact copy of this string filter.
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 boolean isActive()
          Returns whether or not this filter is currently active
 void isActive(boolean active)
          Sets whether or not this filter is currently active
 boolean matches(java.lang.String probe)
          Tests if the given string matches the pattern.
 java.lang.String toString()
           
 
Methods inherited from class org.pf.text.StringPattern
appendAsJSONString, containsWildcard, create, create, create, create, getDefaultMultiCharWildcard, getDefaultSingleCharWildcard, getIgnoreCase, getMultiCharWildcard, getPattern, getSingleCharWildcard, hasWildcard, match, matchIgnoreCase, multiCharWildcardMatchesEmptyString, multiCharWildcardMatchesEmptyString, reject, select, setDigitWildcardChar, setIgnoreCase, setMultiCharWildcard, setPattern, setSingleCharWildcard, toJSON
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringFilter

public StringFilter(java.lang.String pattern,
                    boolean ignoreCase,
                    boolean active)
Initializes the new instance with the string pattern and the selecteion, if case should be ignored when comparing characters.

Parameters:
pattern - The pattern to check against ( May contain '*' and '?' wildcards )
ignoreCase - Definition, if case sensitive character comparison or not.
active - Defines whether or not the filter is initially active.

StringFilter

public StringFilter(java.lang.String pattern,
                    boolean ignoreCase)
Initializes the new instance with the string pattern and the selecteion, if case should be ignored when comparing characters.

Parameters:
pattern - The pattern to check against ( May contain '*' and '?' wildcards )
ignoreCase - Definition, if case sensitive character comparison or not.

StringFilter

public StringFilter(java.lang.String pattern)
Initializes the new instance with the string pattern. The default is case sensitive checking.

Parameters:
pattern - The pattern to check against ( May contain '*' and '?' wildcards )

StringFilter

public StringFilter(java.lang.String pattern,
                    char digitWildcard)
Initializes the new instance with the string pattern and a digit wildcard character. The default is case sensitive checking.

Parameters:
pattern - The pattern to check against ( May contain '*', '?' wildcards and the digit wildcard )
digitWildcard - A wildcard character that stands as placeholder for digits

StringFilter

public StringFilter(java.lang.String pattern,
                    boolean ignoreCase,
                    char digitWildcard)
Initializes the new instance with the string pattern and the selecteion, if case should be ignored when comparing characters plus a wildcard character for digits.

Parameters:
pattern - The pattern to check against ( May contain '*' and '?' wildcards )
ignoreCase - Definition, if case sensitive character comparison or not.
digitWildcard - A wildcard character that stands as placeholder for digits
Method Detail

copy

public StringFilter copy()
Returns a new object that is an exact copy of this string filter.

Overrides:
copy in class org.pf.text.StringPattern

isActive

public boolean isActive()
Returns whether or not this filter is currently active


isActive

public void isActive(boolean active)
Sets whether or not this filter is currently active


matches

public boolean matches(java.lang.String probe)
Tests if the given string matches the pattern. If this filter is deactivated this method returns false.

Specified by:
matches in interface org.pf.bif.filter.IObjectFilter<java.lang.String>
Specified by:
matches in interface org.pf.text.StringFilter
Overrides:
matches in class org.pf.text.StringPattern
Parameters:
probe - The string to compare to the pattern
Returns:
true if and only if the probe matches the pattern, false otherwise.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class org.pf.text.StringPattern

hashCode

public int hashCode()
Overrides:
hashCode in class org.pf.text.StringPattern

toString

public java.lang.String toString()
Overrides:
toString in class org.pf.text.StringPattern

appendToBuffer

public void appendToBuffer(java.lang.StringBuffer buffer)
Append this filter's string representation to the given buffer.