diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-03-28 08:47:45 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-03-28 08:47:45 -0400 |
| commit | 260cc55c485980cd31193300962a88f1de8d62f7 (patch) | |
| tree | c08c646056d04352e18bb80e07b9a35765c8946f /BJC-Utils2/src/main/java/bjc/utils/dice/ReferenceDiceExpression.java | |
| parent | 4d904a55a1b5fe6506f81c2c292c07dfe839029f (diff) | |
Moved dice things to seperate project
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 | 70 |
1 files changed, 0 insertions, 70 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 deleted file mode 100644 index d38e0f9..0000000 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/ReferenceDiceExpression.java +++ /dev/null @@ -1,70 +0,0 @@ -package bjc.utils.dice; - -import java.util.Map; - -/** - * A dice expression that refers to a variable bound in a mutable - * enviroment - * - * @author ben - * - */ -public class ReferenceDiceExpression implements IDiceExpression { - /** - * The enviroment to do variable dereferencing against - */ - private Map<String, IDiceExpression> env; - - /** - * The name of the bound variable - */ - private String name; - - /** - * Create a new reference dice expression referring to the given name - * in an enviroment - * - * @param name - * The name of the bound variable - * @param env - * The enviroment to resolve the variable against - */ - public ReferenceDiceExpression(String name, - Map<String, IDiceExpression> env) { - this.name = name; - 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)) { - return env.get(name).toString(); - } else { - return name; - } - } -} |
