summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/dice/ReferenceDiceExpression.java
diff options
context:
space:
mode:
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.java70
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;
- }
- }
-}