Class RegexSet

java.lang.Object
dev.yasint.regexsynth.ast.RegexSet
All Implemented Interfaces:
Expression

public final class RegexSet
extends java.lang.Object
implements Expression
Synthesis :: Regular Expression Set

This generates a regular expression set when given a range or chars. This class handles the simple character class and ranged character classes expressions along with set negation.

  • Method Summary

    Modifier and Type Method Description
    RegexSet difference​(RegexSet b)
    Performs a subtraction of two regular expressions set.
    RegexSet intersection​(RegexSet b)
    Performs a intersection of two regular expressions set.
    java.lang.StringBuilder toRegex()
    Creates a character class expression.
    RegexSet union​(RegexSet b)
    Performs a union of two regular expressions set.
    RegexSet withUnicodeClass​(UnicodeScript block, boolean negated)
    This allows you to include unicode blocks to a set expression.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface dev.yasint.regexsynth.core.Expression

    debug
  • Method Details

    • union

      public RegexSet union​(RegexSet b)
      Performs a union of two regular expressions set. It will modify the source set @code{this} while operating.
      Parameters:
      b - set expression b
      Returns:
      elements that belongs to this or b
    • intersection

      public RegexSet intersection​(RegexSet b)
      Performs a intersection of two regular expressions set. It will modify the source set @code{this} while operating.
      Parameters:
      b - set expression b
      Returns:
      elements that belongs to this and b
    • difference

      public RegexSet difference​(RegexSet b)
      Performs a subtraction of two regular expressions set. It will modify the source set @code{this} while operating.
      Parameters:
      b - set expression b
      Returns:
      elements that belongs to this and not to b
    • withUnicodeClass

      public RegexSet withUnicodeClass​(UnicodeScript block, boolean negated)
      This allows you to include unicode blocks to a set expression. Note that when a block is included to a set. It does not check for ranges, it simply append the correct syntax to the set expression. i.e. [0-9A-Z\p{Arabic}]
      Parameters:
      negated - whether this unicode block is negated or not
      block - valid unicode general category / script block
      Returns:
      this
    • toRegex

      public java.lang.StringBuilder toRegex()
      Creates a character class expression. This algorithm uses unicode codepoints to create character class ranges.
      Specified by:
      toRegex in interface Expression
      Returns:
      set expression