diff options
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; - } } |
