From 42f7d379a430aaf2fad169f0170de04072b08b10 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Fri, 22 Apr 2016 14:48:04 -0400 Subject: Formatting changes --- .../main/java/bjc/utils/gen/WeightedGrammar.java | 92 +++++++++++----------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/gen') 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 8d31576..131e507 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gen/WeightedGrammar.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gen/WeightedGrammar.java @@ -186,6 +186,34 @@ public class WeightedGrammar { return true; } + /** + * Remove a rule with the specified name. + * + * @param name + * The name of the rule to remove. + */ + public void deleteRule(E name) { + if (name == null) { + throw new NullPointerException("Rule name must not be null"); + } + + rules.remove(name); + } + + /** + * Remove a subgrammar with the specified name. + * + * @param name + * The name of the subgrammar to remove. + */ + public void deleteSubgrammar(E name) { + if (name == null) { + throw new NullPointerException("Rule name must not be null"); + } + + subgrammars.remove(name); + } + /** * Generate a set of debug sentences for the specified rule. Only * generates sentances one layer deep. @@ -294,6 +322,24 @@ public class WeightedGrammar { return initialRule; } + /** + * Returns the number of rules in this grammar + * + * @return The number of rules in this grammar + */ + public int getRuleCount() { + return rules.getSize(); + } + + /** + * Returns a set containing all of the rules in this grammar + * + * @return The set of all rule names in this grammar + */ + public IFunctionalList getRuleNames() { + return rules.keyList(); + } + /** * Get the subgrammar with the specified name. * @@ -428,52 +474,6 @@ public class WeightedGrammar { .doWith((left, right) -> addCase(ruleName, left, right))); } - /** - * Remove a rule with the specified name. - * - * @param name - * The name of the rule to remove. - */ - public void deleteRule(E name) { - if (name == null) { - throw new NullPointerException("Rule name must not be null"); - } - - rules.remove(name); - } - - /** - * Remove a subgrammar with the specified name. - * - * @param name - * The name of the subgrammar to remove. - */ - public void deleteSubgrammar(E name) { - if (name == null) { - throw new NullPointerException("Rule name must not be null"); - } - - subgrammars.remove(name); - } - - /** - * Returns the number of rules in this grammar - * - * @return The number of rules in this grammar - */ - public int getRuleCount() { - return rules.getSize(); - } - - /** - * Returns a set containing all of the rules in this grammar - * - * @return The set of all rule names in this grammar - */ - public IFunctionalList getRuleNames() { - return rules.keyList(); - } - /** * Set the initial rule of the graphic * -- cgit v1.2.3