From 44a8d9d2d56a311293ec86ea40df7126748300a1 Mon Sep 17 00:00:00 2001 From: "Benjamin J. Culkin" Date: Thu, 7 Jun 2018 20:37:51 -0300 Subject: Refactoring The main refactoring here is removing the type field from the various classes, but there are a few other smaller ones. This also contains the grounds for a refactoring on variable use --- src/main/java/bjc/rgens/parser/RegexRuleCase.java | 31 ++++++++--------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'src/main/java/bjc/rgens/parser/RegexRuleCase.java') diff --git a/src/main/java/bjc/rgens/parser/RegexRuleCase.java b/src/main/java/bjc/rgens/parser/RegexRuleCase.java index 3a8a8ad..3c57489 100755 --- a/src/main/java/bjc/rgens/parser/RegexRuleCase.java +++ b/src/main/java/bjc/rgens/parser/RegexRuleCase.java @@ -6,31 +6,22 @@ import bjc.utils.funcdata.IList; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; +/* + * @TODO + * + * Actually implement this + */ public class RegexRuleCase extends RuleCase { - private Pattern patt; + public RegexRuleCase(IList elements) { + super(elements); - public RegexRuleCase(IList elements, String pattern) { - super(CaseType.REGEX, elements); - - elementList = elements; - - try { - patt = Pattern.compile(pattern); - } catch (PatternSyntaxException psex) { - IllegalArgumentException iaex = - new IllegalArgumentException("This type requires a valid regular expression parameter"); - - iaex.initCause(psex); - - throw iaex; - } - } - - public Pattern getPattern() { - return patt; } public void generate(GenerationState state) { } + + public RegexRuleCase withElements(IList elements) { + return new RegexRuleCase(elements); + } } -- cgit v1.2.3