diff options
| author | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2017-07-23 16:27:29 -0300 |
|---|---|---|
| committer | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2017-07-23 16:27:29 -0300 |
| commit | 985c3e8e9eeff790a138d74aeea30bc069cb97f9 (patch) | |
| tree | 610482757b04c338715af176aad680254c1fef8e /RGens/src/main/java/bjc/rgens/newparser/Rule.java | |
| parent | 37caa6e5d2108778e7ee0c7940bd2b7d2b13095c (diff) | |
Formatting
Diffstat (limited to 'RGens/src/main/java/bjc/rgens/newparser/Rule.java')
| -rw-r--r-- | RGens/src/main/java/bjc/rgens/newparser/Rule.java | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/RGens/src/main/java/bjc/rgens/newparser/Rule.java b/RGens/src/main/java/bjc/rgens/newparser/Rule.java index 0197860..aee1a89 100644 --- a/RGens/src/main/java/bjc/rgens/newparser/Rule.java +++ b/RGens/src/main/java/bjc/rgens/newparser/Rule.java @@ -7,7 +7,7 @@ import java.util.Random; /** * A rule in a randomized grammar. - * + * * @author EVE * */ @@ -21,17 +21,17 @@ public class Rule { /** * Create a new grammar rule. - * + * * @param ruleName * The name of the grammar rule. - * + * * @throws IllegalArgumentException * If the rule name is invalid. */ public Rule(String ruleName) { - if(ruleName == null) { + if (ruleName == null) { throw new NullPointerException("Rule name must not be null"); - } else if(ruleName.equals("")) { + } else if (ruleName.equals("")) { throw new IllegalArgumentException("The empty string is not a valid rule name"); } @@ -42,12 +42,12 @@ public class Rule { /** * Adds a case to the rule. - * + * * @param cse * The case to add. */ public void addCase(RuleCase cse) { - if(cse == null) { + if (cse == null) { throw new NullPointerException("Case must not be null"); } @@ -56,7 +56,7 @@ public class Rule { /** * Get a random case from this rule. - * + * * @return A random case from this rule. */ public RuleCase getCase() { @@ -65,10 +65,10 @@ public class Rule { /** * Get a random case from this rule. - * + * * @param rnd * The random number generator to use. - * + * * @return A random case from this rule. */ public RuleCase getCase(Random rnd) { @@ -77,7 +77,7 @@ public class Rule { /** * Get all the cases of this rule. - * + * * @return All the cases in this rule. */ public IList<RuleCase> getCases() { @@ -97,19 +97,21 @@ public class Rule { @Override public boolean equals(Object obj) { - if(this == obj) return true; - if(obj == null) return false; - if(!(obj instanceof Rule)) return false; + if (this == obj) return true; + + if (obj == null) return false; + + if (!(obj instanceof Rule)) return false; Rule other = (Rule) obj; - if(cases == null) { - if(other.cases != null) return false; - } else if(!cases.equals(other.cases)) return false; + if (cases == null) { + if (other.cases != null) return false; + } else if (!cases.equals(other.cases)) return false; - if(name == null) { - if(other.name != null) return false; - } else if(!name.equals(other.name)) return false; + if (name == null) { + if (other.name != null) return false; + } else if (!name.equals(other.name)) return false; return true; } |
