Class CharacterClass

java.lang.Object
easyIO.regexp.RegExp
easyIO.regexp.CharacterClass

public class CharacterClass extends RegExp
A set of characters (Unicode codepoints), matching any one character in the set. The set is represented canonically as sorted, disjoint, non-adjacent ranges, so that equal sets are equal regular expressions; a negated class is stored as the complement of its ranges.
  • Method Details

    • of

      public static RegExp of(int[] ranges, boolean negated)
      A canonical RE matching any one character in the given ranges, or any one character not in them if negated. The ranges are given as pairs (start0, end0, start1, end1, ...), inclusive, in any order, possibly overlapping. An empty set is void, and a single character is a string.
    • range

      public static RegExp range(int start, int end)
      Any one character from start to end, inclusive.
    • excludeRange

      public static RegExp excludeRange(int start, int end)
      Any one character not from start to end.
    • anyChar

      public static RegExp anyChar()
      Any one character.
    • anyButLineBreak

      public static RegExp anyButLineBreak()
      Any one character except a line break ('\n' or '\r'). This is the meaning of '.' in a pattern.
    • contains

      public boolean contains(int codepoint)
      Whether codepoint is in this class.
    • nullable

      public boolean nullable()
      Description copied from class: RegExp
      Whether this RE matches the empty string
      Overrides:
      nullable in class RegExp
    • computeDerivative

      public RegExp computeDerivative(int codepoint)
    • appendString

      public void appendString(StringBuilder b, int precedence)
      Description copied from class: RegExp
      Append a string representation of the regular expression to the builder b. The precedence of the surrounding context is provided so that necessary parentheses can be added. Precedences: 0 = top level 1 = | 2 = concat 3 = star
      Specified by:
      appendString in class RegExp
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object