diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-03-22 12:28:35 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-03-22 12:28:35 -0400 |
| commit | 01cb9f504c860bc1c037a44f3a76bf342a293d46 (patch) | |
| tree | 02d1d34de0828159bbda93e881c93a6b45720f32 /BJC-Utils2/src/main/java/bjc/utils/dice/ReferenceDiceExpression.java | |
| parent | 4685955a62c430007c5c8ed2b915ffc618d30aca (diff) | |
General formatting cleanup and documentation update
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/dice/ReferenceDiceExpression.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/dice/ReferenceDiceExpression.java | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/ReferenceDiceExpression.java b/BJC-Utils2/src/main/java/bjc/utils/dice/ReferenceDiceExpression.java index d8062da..d38e0f9 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/ReferenceDiceExpression.java +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/ReferenceDiceExpression.java @@ -11,14 +11,14 @@ import java.util.Map; */ public class ReferenceDiceExpression implements IDiceExpression { /** - * The name of the bound variable + * The enviroment to do variable dereferencing against */ - private String name; + private Map<String, IDiceExpression> env; /** - * The enviroment to do variable dereferencing against + * The name of the bound variable */ - private Map<String, IDiceExpression> env; + private String name; /** * Create a new reference dice expression referring to the given name @@ -35,11 +35,30 @@ public class ReferenceDiceExpression implements IDiceExpression { this.env = env; } + /** + * Get the name of the referenced variable + * + * @return the name of the referenced variable + */ + public String getName() { + return name; + } + + /* + * (non-Javadoc) + * + * @see bjc.utils.dice.IDiceExpression#roll() + */ @Override public int roll() { return env.get(name).roll(); } + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ @Override public String toString() { if (env.containsKey(name)) { @@ -48,13 +67,4 @@ public class ReferenceDiceExpression implements IDiceExpression { return name; } } - - /** - * Get the name of the referenced variable - * - * @return the name of the referenced variable - */ - public String getName() { - return name; - } } |
