From dca8e9f586fd595a7995f07788318fb92b8cce79 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 28 Jul 2016 16:44:36 -0400 Subject: Format/Cleanup pass --- .../src/main/java/bjc/utils/gen/WeightedGrammar.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/gen/WeightedGrammar.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/gen/WeightedGrammar.java b/BJC-Utils2/src/main/java/bjc/utils/gen/WeightedGrammar.java index 78db7d8..fe10741 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gen/WeightedGrammar.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gen/WeightedGrammar.java @@ -23,7 +23,7 @@ public class WeightedGrammar { /** * The initial rule of the grammar */ - protected String initialRule; + protected String initialRule; /** * The rules currently in this grammar @@ -33,12 +33,12 @@ public class WeightedGrammar { /** * The random number generator used for random numbers */ - private Random rng; + private Random rng; /** * All of the subgrammars of this grammar */ - protected IMap> subgrammars; + protected IMap> subgrammars; /** * Create a new weighted grammar. @@ -76,8 +76,7 @@ public class WeightedGrammar { * @param cse * The case being added. */ - public void addCase(E ruleName, int probability, - IList cse) { + public void addCase(E ruleName, int probability, IList cse) { if (ruleName == null) { throw new NullPointerException("Rule name must be not null"); } else if (cse == null) { @@ -145,8 +144,7 @@ public class WeightedGrammar { * The set of cases for the rule. * @return Whether or not the rule was succesfully added. */ - public boolean addRule(E name, - WeightedRandom> cases) { + public boolean addRule(E name, WeightedRandom> cases) { if (name == null) { throw new NullPointerException("Name must not be null"); } else if (cases == null) { @@ -222,16 +220,14 @@ public class WeightedGrammar { * The rule to test. * @return A set of sentances generated by the specified rule. */ - public IList> generateDebugValues( - E ruleName) { + public IList> generateDebugValues(E ruleName) { if (ruleName == null) { throw new NullPointerException("Rule name must not be null"); } IList> returnedList = new FunctionalList<>(); - WeightedRandom> ruleGenerator = rules - .get(ruleName); + WeightedRandom> ruleGenerator = rules.get(ruleName); for (int i = 0; i < 10; i++) { returnedList.add(ruleGenerator.generateValue()); -- cgit v1.2.3