From d4ca769e542b2489b1e23cfcbdc3a0b7275b87cd Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Mon, 13 Apr 2020 18:40:41 -0400 Subject: Cleanup pass Cleanup pass to uniformize things --- base/src/main/java/bjc/utils/gen/RandomGrammar.java | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'base/src/main/java/bjc/utils/gen/RandomGrammar.java') diff --git a/base/src/main/java/bjc/utils/gen/RandomGrammar.java b/base/src/main/java/bjc/utils/gen/RandomGrammar.java index d0a71c5..050165b 100644 --- a/base/src/main/java/bjc/utils/gen/RandomGrammar.java +++ b/base/src/main/java/bjc/utils/gen/RandomGrammar.java @@ -9,7 +9,7 @@ import bjc.funcdata.IList; * @author ben * * @param - * The type of grammar elements to use. + * The type of grammar elements to use. */ public class RandomGrammar extends WeightedGrammar { /** Create a new random grammar. */ @@ -21,14 +21,14 @@ public class RandomGrammar extends WeightedGrammar { * Add cases to a specified rule. * * @param rule - * The name of the rule to add cases to. + * The name of the rule to add cases to. * * @param cases - * The cases to add for this rule. + * The cases to add for this rule. */ @SafeVarargs public final void addCases(final E rule, final IList... cases) { - for(final IList currentCase : cases) { + for (final IList currentCase : cases) { super.addCase(rule, 1, currentCase); } } @@ -37,16 +37,16 @@ public class RandomGrammar extends WeightedGrammar { * Create a rule with the specified name and cases. * * @param rule - * The name of the rule to add. + * The name of the rule to add. * * @param cases - * The cases to add for this rule. + * 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) { + for (final IList currentCase : cases) { super.addCase(rule, 1, currentCase); } } @@ -55,13 +55,14 @@ public class RandomGrammar extends WeightedGrammar { * Create a rule with the specified name and cases. * * @param rule - * The name of the rule to add. + * The name of the rule to add. * * @param cases - * The cases to add for this rule. + * 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"); + if (cases == null) + throw new NullPointerException("Cases must not be null"); super.addRule(rule); -- cgit v1.2.3