diff options
| author | EVE <EVE@EVE-PC> | 2017-03-14 12:07:14 -0400 |
|---|---|---|
| committer | EVE <EVE@EVE-PC> | 2017-03-14 12:07:14 -0400 |
| commit | 504ca816530efdff06bc202e0432ebd354aec304 (patch) | |
| tree | 4836932fb81d1d625470502c78c94d202c9a7420 /BJC-Utils2/src/main/java/bjc/utils/gen/RandomGrammar.java | |
| parent | 5c1163df17c46f7d3e15b6c7949c38843ec56146 (diff) | |
Cleanup
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/gen/RandomGrammar.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/gen/RandomGrammar.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gen/RandomGrammar.java b/BJC-Utils2/src/main/java/bjc/utils/gen/RandomGrammar.java index 5d054cf..4153e7d 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gen/RandomGrammar.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gen/RandomGrammar.java @@ -5,7 +5,7 @@ import bjc.utils.funcdata.IList; /** * A weighted grammar where all the rules have a equal chance of occuring. - * + * * @author ben * * @param <E> @@ -21,7 +21,7 @@ public class RandomGrammar<E> extends WeightedGrammar<E> { /** * Add cases to a specified rule. - * + * * @param rule * The name of the rule to add cases to. * @param cases @@ -29,14 +29,14 @@ public class RandomGrammar<E> extends WeightedGrammar<E> { */ @SafeVarargs public final void addCases(E rule, IList<E>... cases) { - for (IList<E> currentCase : cases) { + for(IList<E> 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 @@ -46,23 +46,21 @@ public class RandomGrammar<E> extends WeightedGrammar<E> { public final void makeRule(E rule, IList<E>... cases) { super.addRule(rule); - for (IList<E> currentCase : cases) { + for(IList<E> 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(E rule, 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); |
