LOGGER.finer("just added left value: " + currentState); } else if (currentState.equals("rightValue")) { ((MathExpressionImpl) curExprssn).setExpression2(expFactory.create()); currentState = "complete"; expFactory = null;
/** * Adds the 'right' value to this expression. * * @param rightValue Expression to add to this expression. * * @throws IllegalFilterException Attempting to add non-math expression. * * @deprecated use {@link #setExpression2(org.opengis.filter.expression.Expression)} */ public final void addRightValue(Expression rightValue) throws IllegalFilterException { setExpression2(rightValue); }
/** * Adds the 'right' value to this expression. * * @param rightValue Expression to add to this expression. * * @throws IllegalFilterException Attempting to add non-math expression. * * @deprecated use {@link #setExpression2(org.opengis.filter.expression.Expression)} */ public final void addRightValue(Expression rightValue) throws IllegalFilterException { setExpression2(rightValue); }
public void testExpressionMath() { try { MathExpressionImpl testMath1; MathExpressionImpl testMath2; testExp1 = new LiteralExpressionImpl(new Double(5)); testExp2 = new LiteralExpressionImpl(new Double(5)); testMath1 = new AddImpl(null, null); testMath1.setExpression1(testExp1); testMath1.setExpression2(testExp2); testMath2 = new AddImpl(null, null); testMath2.setExpression1(testExp2); testMath2.setExpression2(testExp1); assertTrue(testMath1.equals(testMath2)); testExp3 = new LiteralExpressionImpl(Integer.valueOf(4)); testExp4 = new LiteralExpressionImpl(Integer.valueOf(4)); testMath2.setExpression1(testExp3); assertTrue(!testMath1.equals(testMath2)); testMath1.setExpression1(testExp4); assertTrue(testMath1.equals(testMath2)); testMath1 = new SubtractImpl(null, null); testMath1.setExpression1(testExp4); testMath1.setExpression1(testExp2); assertTrue(!testMath1.equals(testMath2)); assertTrue(!testMath1.equals("Random Object that happens to be a string")); } catch (IllegalFilterException e) { LOGGER.warning("bad filter: " + e.getMessage()); } }
mathTest.setExpression2(testAttribute2); mathTest.setExpression2(testAttribute2); mathTest.setExpression2(testAttribute2); mathTest.setExpression2(testAttribute2);
public void testIncompleteMathExpression() throws IllegalFilterException { Expression testAttribute1 = new LiteralExpressionImpl(Integer.valueOf(4)); MathExpressionImpl mathTest = new AddImpl(null, null); mathTest.setExpression1(testAttribute1); try { mathTest.evaluate(testFeature); fail("math expressions should not work if right hand side is not set"); } catch (IllegalArgumentException ife) { } mathTest = new AddImpl(null, null); mathTest.setExpression2(testAttribute1); try { mathTest.evaluate(testFeature); fail("math expressions should not work if left hand side is not set"); } catch (IllegalArgumentException ife) { } }
mathTest.setExpression2(testAttribute2); LOGGER.fine( "math test: " mathTest.setExpression2(testAttribute2); LOGGER.fine( "math test: " mathTest.setExpression2(testAttribute2); LOGGER.fine( "math test: " mathTest.setExpression2(testAttribute2); LOGGER.fine( "math test: "
/** * Adds the maths expression. * * @param node the node * @param mathExpression the math expression * @return the expression */ private Expression addMathsExpression(ExpressionNode node, MathExpressionImpl mathExpression) { ExpressionNode leftChildNode = (ExpressionNode) node.getChildAt(0); mathExpression.setExpression1(addExpression(leftChildNode)); ExpressionNode rightChildNode = (ExpressionNode) node.getChildAt(1); mathExpression.setExpression2(addExpression(rightChildNode)); return mathExpression; }
mathExpression.setExpression1(addExpression(leftChildNode)); ExpressionNode rightChildNode = (ExpressionNode) node.getChildAt(1); mathExpression.setExpression2(addExpression(rightChildNode));