diff options
| author | Ben Culkin <scorpress@gmail.com> | 2020-04-13 18:40:41 -0400 |
|---|---|---|
| committer | Ben Culkin <scorpress@gmail.com> | 2020-04-13 18:40:41 -0400 |
| commit | d4ca769e542b2489b1e23cfcbdc3a0b7275b87cd (patch) | |
| tree | 1653a7399f97fb0c63ce62e3f60fd830d5c37f70 /base/src/main/java/bjc/utils/gen/RandomGrammar.java | |
| parent | 2ac2e31a56ae59ee582e43a90c3495f86dd9ee7a (diff) | |
Cleanup pass
Cleanup pass to uniformize things
Diffstat (limited to 'base/src/main/java/bjc/utils/gen/RandomGrammar.java')
| -rw-r--r-- | base/src/main/java/bjc/utils/gen/RandomGrammar.java | 21 |
1 files changed, 11 insertions, 10 deletions
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 <E> - * The type of grammar elements to use. + * The type of grammar elements to use. */ public class RandomGrammar<E> extends WeightedGrammar<E> { /** Create a new random grammar. */ @@ -21,14 +21,14 @@ public class RandomGrammar<E> extends WeightedGrammar<E> { * 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<E>... cases) { - for(final IList<E> currentCase : cases) { + for (final IList<E> currentCase : cases) { super.addCase(rule, 1, currentCase); } } @@ -37,16 +37,16 @@ public class RandomGrammar<E> extends WeightedGrammar<E> { * 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<E>... cases) { super.addRule(rule); - for(final IList<E> currentCase : cases) { + for (final IList<E> currentCase : cases) { super.addCase(rule, 1, currentCase); } } @@ -55,13 +55,14 @@ public class RandomGrammar<E> extends WeightedGrammar<E> { * 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<IList<E>> 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); |
