Class CharacterSet

  • All Implemented Interfaces:
    Serializable

    public final class CharacterSet
    extends Component
    This regular expression component matches only those characters listed in its set. This pattern element has an associated minimum and maximum range. The component must match at least the minimum count and up to the maximum count (inclusive).

    This set may also be negated which means that it will match any character except those listed in its set.

    Author:
    Charles Rapp
    See Also:
    Serialized Form
    • Method Detail

      • lessThan

        public boolean lessThan​(char c)
        Returns true if this component is less than the character c; returns false otherwise. A character set is less than a specific character if the set's smallest character is less than c.
        Specified by:
        lessThan in class Component
        Parameters:
        c - Test against this character.
        Returns:
        true if this component is less than the character c; returns false otherwise.
      • equalTo

        public boolean equalTo​(char c)
        Returns true if this component is equal to the character c; returns false otherwise. A character set is equal to a specific characer if c is in the set.
        Specified by:
        equalTo in class Component
        Parameters:
        c - Test against this character.
        Returns:
        true if this component is equal to the character c; returns false otherwise.
      • greaterThan

        public boolean greaterThan​(char c)
        Returns true if this component is greater than the character c; returns false otherwise. A character set is greater than a specified character if the set's maximum character is greater than c.
        Specified by:
        greaterThan in class Component
        Parameters:
        c - Test against this character.
        Returns:
        true if this component is greater than the character c; returns false otherwise.
      • isNegated

        public boolean isNegated()
        Returns true if this character is negated (^) and false otherwise.
        Returns:
        true if this character is negated (^) and false otherwise.
      • toString

        public String toString()
        Returns a textual representation of a character set.
        Overrides:
        toString in class Object
        Returns:
        a textual representation of a character set.