diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-11 09:33:11 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-11 09:33:11 -0400 |
| commit | b5e55a66c58089bbde3f3dc4ebfc2ede700b9f00 (patch) | |
| tree | af6fd8a63d87624444e1b00440e773121d23e2bf /dice-lang/src/main/java/bjc/dicelang/ast/DiceASTEvaluator.java | |
| parent | 75fe5c351630ce26a9bd4db631809bb8d5b26357 (diff) | |
Adjusted to new method in pairs and holders
Diffstat (limited to 'dice-lang/src/main/java/bjc/dicelang/ast/DiceASTEvaluator.java')
| -rw-r--r-- | dice-lang/src/main/java/bjc/dicelang/ast/DiceASTEvaluator.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTEvaluator.java b/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTEvaluator.java index 0257b91..c214776 100644 --- a/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTEvaluator.java +++ b/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTEvaluator.java @@ -50,8 +50,8 @@ public class DiceASTEvaluator { public IPair<Integer, AST<IDiceASTNode>> apply( IPair<Integer, AST<IDiceASTNode>> leftNode, IPair<Integer, AST<IDiceASTNode>> rightNode) { - return leftNode.merge((leftValue, leftAST) -> { - return rightNode.merge((rightValue, rightAST) -> { + return leftNode.bind((leftValue, leftAST) -> { + return rightNode.bind((rightValue, rightAST) -> { if (type == OperatorDiceNode.DIVIDE && rightValue == 0) { throw new ArithmeticException( @@ -179,8 +179,8 @@ public class DiceASTEvaluator { IFunctionalMap<String, AST<IDiceASTNode>> enviroment, IPair<Integer, AST<IDiceASTNode>> left, IPair<Integer, AST<IDiceASTNode>> right) { - return left.merge((leftValue, leftAST) -> { - return right.merge((rightValue, rightAST) -> { + return left.bind((leftValue, leftAST) -> { + return right.bind((rightValue, rightAST) -> { String variableName = leftAST.applyToHead((node) -> { if (node.getType() != DiceASTType.VARIABLE) { throw new UnsupportedOperationException( @@ -224,8 +224,8 @@ public class DiceASTEvaluator { private static IPair<Integer, AST<IDiceASTNode>> parseCompound( IPair<Integer, AST<IDiceASTNode>> leftNode, IPair<Integer, AST<IDiceASTNode>> rightNode) { - return leftNode.merge((leftValue, leftAST) -> { - return rightNode.merge((rightValue, rightAST) -> { + return leftNode.bind((leftValue, leftAST) -> { + return rightNode.bind((rightValue, rightAST) -> { int compoundValue = Integer.parseInt(Integer.toString(leftValue) + Integer.toString(rightValue)); @@ -239,8 +239,8 @@ public class DiceASTEvaluator { private static IPair<Integer, AST<IDiceASTNode>> parseGroup( IPair<Integer, AST<IDiceASTNode>> leftNode, IPair<Integer, AST<IDiceASTNode>> rightNode) { - return leftNode.merge((leftValue, leftAST) -> { - return rightNode.merge((rightValue, rightAST) -> { + return leftNode.bind((leftValue, leftAST) -> { + return rightNode.bind((rightValue, rightAST) -> { if (leftValue < 0) { throw new UnsupportedOperationException( "Can't attempt to roll a negative number of dice." |
