diff options
| author | bjculkin <bjculkin@mix.wvu.edu> | 2017-03-21 14:08:50 -0400 |
|---|---|---|
| committer | bjculkin <bjculkin@mix.wvu.edu> | 2017-03-21 14:08:50 -0400 |
| commit | a7e84eea087a35721a971e827149f0ca5fba4676 (patch) | |
| tree | fbb7b0e5e402fb2a4aae5614c51f1955640a09e8 /dice-lang/src/bjc/dicelang/v1/BindingDiceExpression.java | |
| parent | 94913a2fccff9e80f84ac477c2020bd7c7b1833a (diff) | |
Remove version 1 files
Remove the old, not used version 1 files from the repository. Check the
history if you care about them.
Diffstat (limited to 'dice-lang/src/bjc/dicelang/v1/BindingDiceExpression.java')
| -rw-r--r-- | dice-lang/src/bjc/dicelang/v1/BindingDiceExpression.java | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/dice-lang/src/bjc/dicelang/v1/BindingDiceExpression.java b/dice-lang/src/bjc/dicelang/v1/BindingDiceExpression.java deleted file mode 100644 index 14dbc42..0000000 --- a/dice-lang/src/bjc/dicelang/v1/BindingDiceExpression.java +++ /dev/null @@ -1,87 +0,0 @@ -package bjc.dicelang.v1; - -import java.util.Map; - -/** - * A variable expression that represents binding a variable to a name in an - * enviroment - * - * @author ben - * - */ -public class BindingDiceExpression implements IDiceExpression { - /* - * The expression being bound to a name - */ - private IDiceExpression expression; - - /* - * The name to bind the expression to - */ - private String name; - - /** - * Create a new dice expression binder from two expressions and an - * enviroment - * - * @param left - * The left side expression to get a name from. Must be a - * ReferenceDiceExpression - * @param right - * The right side to bind to the name - * @param enviroment - * The enviroment to bind into - */ - public BindingDiceExpression(IDiceExpression left, IDiceExpression right, - Map<String, IDiceExpression> enviroment) { - if(!(left instanceof ReferenceDiceExpression)) throw new UnsupportedOperationException( - "Error: Binding an expression to something that is not a variable reference," - + " or array thereof. is unsupported." + " Problematic expression is " - + left); - - String varName = ((ReferenceDiceExpression) left).getName(); - - initialize(varName, right, enviroment); - } - - /** - * Create a new dice expression binder - * - * @param name - * The name of the variable to bind - * @param expression - * The expression to bind to the variable - * @param enviroment - * The enviroment to bind it in - */ - public BindingDiceExpression(String name, IDiceExpression expression, Map<String, IDiceExpression> enviroment) { - initialize(name, expression, enviroment); - } - - private void initialize(String name, IDiceExpression expr, Map<String, IDiceExpression> enviroment) { - this.name = name; - this.expression = expr; - - enviroment.put(name, expr); - } - - /* - * (non-Javadoc) - * - * @see bjc.utils.dice.IDiceExpression#roll() - */ - @Override - public int roll() { - return expression.roll(); - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "assign[n=" + name + ", exp=" + expression.toString() + "]"; - } -} |
