From b5e55a66c58089bbde3f3dc4ebfc2ede700b9f00 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Mon, 11 Apr 2016 09:33:11 -0400 Subject: Adjusted to new method in pairs and holders --- .../src/main/java/bjc/dicelang/ast/DiceASTEvaluator.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'dice-lang/src/main/java') 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> apply( IPair> leftNode, IPair> 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> enviroment, IPair> left, IPair> 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> parseCompound( IPair> leftNode, IPair> 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> parseGroup( IPair> leftNode, IPair> 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." -- cgit v1.2.3