((MathExpressionImpl) curExprssn).setExpression1(expFactory.create()); currentState = "rightValue"; expFactory = new ExpressionSAXParser(schema);
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()); } }
/** * Adds the 'left' value to this expression. * * @param leftValue Expression to add to this expression. * * @throws IllegalFilterException Attempting to add non-math expression. * * @deprecated use {@link #setExpression1(org.opengis.filter.expression.Expression)} */ public final void addLeftValue(Expression leftValue) throws IllegalFilterException { setExpression1(leftValue); }
/** * Adds the 'left' value to this expression. * * @param leftValue Expression to add to this expression. * * @throws IllegalFilterException Attempting to add non-math expression. * * @deprecated use {@link #setExpression1(org.opengis.filter.expression.Expression)} */ public final void addLeftValue(Expression leftValue) throws IllegalFilterException { setExpression1(leftValue); }
mathTest.setExpression1(testAttribute1); mathTest.setExpression2(testAttribute2); mathTest.setExpression1(testAttribute1); mathTest.setExpression2(testAttribute2); mathTest.setExpression1(testAttribute1); mathTest.setExpression2(testAttribute2); mathTest.setExpression1(testAttribute1); 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.setExpression1(testAttribute1); mathTest.setExpression2(testAttribute2); LOGGER.fine( mathTest.setExpression1(testAttribute1); mathTest.setExpression2(testAttribute2); LOGGER.fine( mathTest.setExpression1(testAttribute1); mathTest.setExpression2(testAttribute2); LOGGER.fine( mathTest.setExpression1(testAttribute1); mathTest.setExpression2(testAttribute2); LOGGER.fine(
/** * 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; }
MathExpressionImpl mathExpression = (MathExpressionImpl) localExpression; ExpressionNode leftChildNode = (ExpressionNode) node.getChildAt(0); mathExpression.setExpression1(addExpression(leftChildNode)); ExpressionNode rightChildNode = (ExpressionNode) node.getChildAt(1); mathExpression.setExpression2(addExpression(rightChildNode));