Package dev.yasint.regexsynth.synthesis
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.StringBuildertoRegex()Synthesizes a given specification into a regular expression.
-
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:ExpressionSynthesizes 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:
toRegexin interfaceExpression- Returns:
- regex equivalent
-