Class RangeExpression

java.lang.Object
dev.yasint.regexsynth.synthesis.RangeExpression
All Implemented Interfaces:
Expression

public class RangeExpression
extends java.lang.Object
implements Expression
Synthesis :: Regular Expression Integer Range

This generates a regular expression number range given inclusive start and end integers. This implementation's running time is O(log n).

This code is originally based on a StackOverflow post answer. However, the code has some optimizations and changes to match our use-case. `https://bit.ly/3bIXZBy`

  • Constructor Summary

    Constructors 
    Constructor Description
    RangeExpression​(int _rStart, int _rEnd)
    Creates a int range expression
  • Method Summary

    Modifier and Type Method Description
    java.lang.StringBuilder toRegex()
    Synthesizes a given specification into a regular 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.api.Expression

    debug
  • Constructor Details

    • RangeExpression

      public RangeExpression​(int _rStart, int _rEnd)
      Creates a int range expression
      Parameters:
      _rStart - int start inclusive
      _rEnd - int end inclusive
  • Method Details

    • toRegex

      public java.lang.StringBuilder toRegex()
      Description copied from interface: Expression
      Synthesizes a given specification into a regular expression. The implementing class can control what should be in the regex by simply wrapping it in a object or a higher-order function.
      Specified by:
      toRegex in interface Expression
      Returns:
      regex equivalent