@Override public ArithmeticExpression clone(List<Expression> children) { return new DoubleAddExpression(children); }
@Test public void add() throws Exception { List<Expression> args = Lists.newArrayList(getInvertedLiteral(10, PInteger.INSTANCE), getLiteral(2)); evaluateAndAssertResult(new DecimalAddExpression(args), BigDecimal.valueOf(12)); args = Lists.newArrayList(getInvertedLiteral(10, PInteger.INSTANCE), getLiteral(2)); evaluateAndAssertResult(new LongAddExpression(args), 12l); args = Lists.newArrayList(getInvertedLiteral(10.0, PFloat.INSTANCE), getLiteral(2)); evaluateAndAssertResult(new DoubleAddExpression(args), 12.0); args = Lists.newArrayList(getInvertedLiteral(10.0, PUnsignedFloat.INSTANCE), getLiteral(2)); evaluateAndAssertResult(new DoubleAddExpression(args), 12.0); args = Lists.newArrayList(getInvertedLiteral(10.0, PUnsignedDouble.INSTANCE), getLiteral(2)); evaluateAndAssertResult(new DoubleAddExpression(args), 12.0); args = Lists.newArrayList(getInvertedLiteral(10.0, PDouble.INSTANCE), getLiteral(2)); evaluateAndAssertResult(new DoubleAddExpression(args), 12.0); }
@Override public ArithmeticExpression clone(List<Expression> children) { return new DoubleAddExpression(children); }
@Override public ArithmeticExpression clone(List<Expression> children) { return new DoubleAddExpression(children); }
op4 = LiteralExpression.newConstant(1.0); children = Arrays.<Expression>asList(op1, op2); e1 = new DoubleAddExpression(children); children = Arrays.<Expression>asList(op3, op4); e2 = new DoubleSubtractExpression(children); e3 = new DoubleAddExpression(Arrays.<Expression>asList(e1, e2)); e4 = new DoubleAddExpression(Arrays.<Expression>asList(new RandomFunction(Arrays.<Expression>asList(LiteralExpression.newConstant(null))), e3)); CloneExpressionVisitor visitor = new CloneExpressionVisitor(); Expression clone = e4.accept(visitor); assertNotEquals(ptr1, ptr2); e4 = new DoubleAddExpression(Arrays.<Expression>asList(new RandomFunction(Arrays.<Expression>asList(LiteralExpression.newConstant(1))), e3)); visitor = new CloneExpressionVisitor(); clone = e4.accept(visitor);
return new LongAddExpression(children); } else if (theType == PDouble.INSTANCE) { return new DoubleAddExpression(children); } else if (theType == null) { return LiteralExpression.newConstant(null, theType, determinism);
return new LongAddExpression(children); } else if (theType == PDouble.INSTANCE) { return new DoubleAddExpression(children); } else if (theType == null) { return LiteralExpression.newConstant(null, theType, determinism);
return new LongAddExpression(children); } else if (theType == PDouble.INSTANCE) { return new DoubleAddExpression(children); } else if (theType == null) { return LiteralExpression.newConstant(null, theType, determinism);