Package org.geotools.filter.expression

Examples of org.geotools.filter.expression.AddImpl.evaluate()


    Expression testAttribute1 = new LiteralExpressionImpl(new Integer(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);
View Full Code Here


    } 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) {
    }
  }
View Full Code Here

    MathExpressionImpl mathTest = new AddImpl(null, null);
    mathTest.setExpression1(testAttribute1);
    mathTest.setExpression2(testAttribute2);
    LOGGER.fine("math test: " + testAttribute1.evaluate(testFeature)
        + " + " + testAttribute2.evaluate(testFeature) + " = "
        + mathTest.evaluate(testFeature));
    assertEquals(new Integer(6), mathTest.evaluate(testFeature,
        Integer.class));

    // Test subtraction
    mathTest = new SubtractImpl(null, null);
View Full Code Here

    mathTest.setExpression1(testAttribute1);
    mathTest.setExpression2(testAttribute2);
    LOGGER.fine("math test: " + testAttribute1.evaluate(testFeature)
        + " + " + testAttribute2.evaluate(testFeature) + " = "
        + mathTest.evaluate(testFeature));
    assertEquals(new Integer(6), mathTest.evaluate(testFeature,
        Integer.class));

    // Test subtraction
    mathTest = new SubtractImpl(null, null);
    mathTest.setExpression1(testAttribute1);
View Full Code Here

    mathTest = new SubtractImpl(null, null);
    mathTest.setExpression1(testAttribute1);
    mathTest.setExpression2(testAttribute2);
    LOGGER.fine("math test: " + testAttribute1.evaluate(testFeature)
        + " - " + testAttribute2.evaluate(testFeature) + " = "
        + mathTest.evaluate(testFeature));
    assertEquals(new Integer(2), mathTest.evaluate(testFeature,
        Integer.class));

    // Test multiplication
    mathTest = new MultiplyImpl(null, null);
View Full Code Here

    mathTest.setExpression1(testAttribute1);
    mathTest.setExpression2(testAttribute2);
    LOGGER.fine("math test: " + testAttribute1.evaluate(testFeature)
        + " - " + testAttribute2.evaluate(testFeature) + " = "
        + mathTest.evaluate(testFeature));
    assertEquals(new Integer(2), mathTest.evaluate(testFeature,
        Integer.class));

    // Test multiplication
    mathTest = new MultiplyImpl(null, null);
    mathTest.setExpression1(testAttribute1);
View Full Code Here

    mathTest = new MultiplyImpl(null, null);
    mathTest.setExpression1(testAttribute1);
    mathTest.setExpression2(testAttribute2);
    LOGGER.fine("math test: " + testAttribute1.evaluate(testFeature)
        + " * " + testAttribute2.evaluate(testFeature) + " = "
        + mathTest.evaluate(testFeature));
    assertEquals(new Integer(8), mathTest.evaluate(testFeature,
        Integer.class));

    // Test division
    mathTest = new DivideImpl(null, null);
View Full Code Here

    mathTest.setExpression1(testAttribute1);
    mathTest.setExpression2(testAttribute2);
    LOGGER.fine("math test: " + testAttribute1.evaluate(testFeature)
        + " * " + testAttribute2.evaluate(testFeature) + " = "
        + mathTest.evaluate(testFeature));
    assertEquals(new Integer(8), mathTest.evaluate(testFeature,
        Integer.class));

    // Test division
    mathTest = new DivideImpl(null, null);
    mathTest.setExpression1(testAttribute1);
View Full Code Here

    mathTest = new DivideImpl(null, null);
    mathTest.setExpression1(testAttribute1);
    mathTest.setExpression2(testAttribute2);
    LOGGER.fine("math test: " + testAttribute1.evaluate(testFeature)
        + " / " + testAttribute2.evaluate(testFeature) + " = "
        + mathTest.evaluate(testFeature));
    assertEquals(new Double(2), mathTest.evaluate(testFeature));
  }

  /**
   * Tests the math expression over other kind of object than Feature.
View Full Code Here

    mathTest.setExpression1(testAttribute1);
    mathTest.setExpression2(testAttribute2);
    LOGGER.fine("math test: " + testAttribute1.evaluate(testFeature)
        + " / " + testAttribute2.evaluate(testFeature) + " = "
        + mathTest.evaluate(testFeature));
    assertEquals(new Double(2), mathTest.evaluate(testFeature));
  }

  /**
   * Tests the math expression over other kind of object than Feature.
   *
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.