From c82e3b3b2de0633317ec8fc85925e91422820597 Mon Sep 17 00:00:00 2001 From: "Benjamin J. Culkin" Date: Sun, 8 Oct 2017 22:39:59 -0300 Subject: Start splitting into maven modules --- .../src/main/java/bjc/utils/gen/RandomGrammar.java | 69 ---------------------- 1 file changed, 69 deletions(-) delete mode 100644 BJC-Utils2/src/main/java/bjc/utils/gen/RandomGrammar.java (limited to 'BJC-Utils2/src/main/java/bjc/utils/gen/RandomGrammar.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/gen/RandomGrammar.java b/BJC-Utils2/src/main/java/bjc/utils/gen/RandomGrammar.java deleted file mode 100644 index 3de08d6..0000000 --- a/BJC-Utils2/src/main/java/bjc/utils/gen/RandomGrammar.java +++ /dev/null @@ -1,69 +0,0 @@ -package bjc.utils.gen; - -import bjc.utils.funcdata.FunctionalMap; -import bjc.utils.funcdata.IList; - -/** - * A weighted grammar where all the rules have a equal chance of occuring. - * - * @author ben - * - * @param - * The type of grammar elements to use. - */ -public class RandomGrammar extends WeightedGrammar { - /** - * Create a new random grammar. - */ - public RandomGrammar() { - rules = new FunctionalMap<>(); - } - - /** - * Add cases to a specified rule. - * - * @param rule - * The name of the rule to add cases to. - * @param cases - * The cases to add for this rule. - */ - @SafeVarargs - public final void addCases(final E rule, final IList... cases) { - for (final IList currentCase : cases) { - super.addCase(rule, 1, currentCase); - } - } - - /** - * Create a rule with the specified name and cases. - * - * @param rule - * The name of the rule to add. - * @param cases - * The cases to add for this rule. - */ - @SafeVarargs - public final void makeRule(final E rule, final IList... cases) { - super.addRule(rule); - - for (final IList currentCase : cases) { - super.addCase(rule, 1, currentCase); - } - } - - /** - * Create a rule with the specified name and cases. - * - * @param rule - * The name of the rule to add. - * @param cases - * The cases to add for this rule. - */ - public void makeRule(final E rule, final IList> cases) { - if (cases == null) throw new NullPointerException("Cases must not be null"); - - super.addRule(rule); - - cases.forEach(currentCase -> super.addCase(rule, 1, currentCase)); - } -} -- cgit v1.2.3