Package org.opengis.filter.expression

Examples of org.opengis.filter.expression.Function


            FilterFunction_floor floor = (FilterFunction_floor) ff.function("floor",
                    org.opengis.filter.expression.Expression.NIL);
            assertEquals("Name is, ", "floor", floor.getName());
            assertEquals("Number of arguments, ", 1, floor.getFunctionName().getArgumentCount());

            Function floorFunction = ff.function("floor", literal_1);
            double good0 = Math.floor(1.0);
            if (Double.isNaN(good0)) {
                assertTrue("floor of (1.0):", Double.isNaN(((Double) floorFunction
                        .evaluate(null)).doubleValue()));
            } else {
                assertEquals("floor of (1.0):", (double) Math.floor(1.0),
                        ((Double) floorFunction.evaluate(null)).doubleValue(),
                        0.00001);
            }
           
            floorFunction = ff.function("floor", literal_m1);
            double good1 = Math.floor(-1.0);
            if (Double.isNaN(good1)) {
                assertTrue("floor of (-1.0):", Double.isNaN(((Double) floorFunction
                        .evaluate(null)).doubleValue()));
            } else {
                assertEquals("floor of (-1.0):", (double) Math.floor(-1.0),
                        ((Double) floorFunction.evaluate(null)).doubleValue(),
                        0.00001);
            }
           
            floorFunction = ff.function("floor", literal_2);
            double good2 = Math.floor(2.0);
            if (Double.isNaN(good2)) {
                assertTrue("floor of (2.0):", Double.isNaN(((Double) floorFunction
                        .evaluate(null)).doubleValue()));
            } else {
                assertEquals("floor of (2.0):", (double) Math.floor(2.0),
                        ((Double) floorFunction.evaluate(null)).doubleValue(),
                        0.00001);
            }
           
            floorFunction = ff.function("floor", literal_m2);
            double good3 = Math.floor(-2.0);
            if (Double.isNaN(good3)) {
                assertTrue("floor of (-2.0):", Double.isNaN(((Double) floorFunction
                        .evaluate(null)).doubleValue()));
            } else {
                assertEquals("floor of (-2.0):", (double) Math.floor(-2.0),
                        ((Double) floorFunction.evaluate(null)).doubleValue(),
                        0.00001);
            }
           
            floorFunction = ff.function("floor", literal_pi);
            double good4 = Math.floor(Math.PI);
            if (Double.isNaN(good4)) {
                assertTrue("floor of (3.141592653589793):", Double
                        .isNaN(((Double) floorFunction.evaluate(null))
                                .doubleValue()));
            } else {
                assertEquals("floor of (3.141592653589793):", (double) Math
                        .floor(3.141592653589793), ((Double) floorFunction
                        .evaluate(null)).doubleValue(), 0.00001);
            }
           
            floorFunction = ff.function("floor", literal_05pi);
            double good5 = Math.floor(1.5707963267948966);
            if (Double.isNaN(good5)) {
                assertTrue("floor of (1.5707963267948966):", Double
                        .isNaN(((Double) floorFunction.evaluate(null))
                                .doubleValue()));
            } else {
                assertEquals("floor of (1.5707963267948966):", (double) Math
                        .floor(1.5707963267948966), ((Double) floorFunction
                        .evaluate(null)).doubleValue(), 0.00001);
            }
        } catch (FactoryRegistryException e) {
            e.printStackTrace();
            fail("Unexpected exception: " + e.getMessage());
View Full Code Here


            FilterFunction_log log = (FilterFunction_log) ff.function("log",
                    org.opengis.filter.expression.Expression.NIL);
            assertEquals("Name is, ", "log", log.getName());
            assertEquals("Number of arguments, ", 1, log.getFunctionName().getArgumentCount());

            Function logFunction = ff.function("log", literal_1);
            double good0 = Math.log(1.0);
            if (Double.isNaN(good0)) {
                assertTrue("log of (1.0):", Double.isNaN(((Double) logFunction
                        .evaluate(null)).doubleValue()));
            } else {
                assertEquals("log of (1.0):", (double) Math.log(1.0),
                        ((Double) logFunction.evaluate(null)).doubleValue(),
                        0.00001);
            }
           
            logFunction = ff.function("log", literal_m1);
            double good1 = Math.log(-1.0);
            if (Double.isNaN(good1)) {
                assertTrue("log of (-1.0):", Double.isNaN(((Double) logFunction
                        .evaluate(null)).doubleValue()));
            } else {
                assertEquals("log of (-1.0):", (double) Math.log(-1.0),
                        ((Double) logFunction.evaluate(null)).doubleValue(),
                        0.00001);
            }
           
            logFunction = ff.function("log", literal_2);
            double good2 = Math.log(2.0);
            if (Double.isNaN(good2)) {
                assertTrue("log of (2.0):", Double.isNaN(((Double) logFunction
                        .evaluate(null)).doubleValue()));
            } else {
                assertEquals("log of (2.0):", (double) Math.log(2.0),
                        ((Double) logFunction.evaluate(null)).doubleValue(),
                        0.00001);
            }
           
            logFunction = ff.function("log", literal_m2);
            double good3 = Math.log(-2.0);
            if (Double.isNaN(good3)) {
                assertTrue("log of (-2.0):", Double.isNaN(((Double) logFunction
                        .evaluate(null)).doubleValue()));
            } else {
                assertEquals("log of (-2.0):", (double) Math.log(-2.0),
                        ((Double) logFunction.evaluate(null)).doubleValue(),
                        0.00001);
            }
           
            logFunction = ff.function("log", literal_pi);
            double good4 = Math.log(Math.PI);
            if (Double.isNaN(good4)) {
                assertTrue("log of (3.141592653589793):", Double
                        .isNaN(((Double) logFunction.evaluate(null))
                                .doubleValue()));
            } else {
                assertEquals("log of (3.141592653589793):", (double) Math
                        .log(3.141592653589793), ((Double) logFunction
                        .evaluate(null)).doubleValue(), 0.00001);
            }
           
            logFunction = ff.function("log", literal_05pi);
            double good5 = Math.log(1.5707963267948966);
            if (Double.isNaN(good5)) {
                assertTrue("log of (1.5707963267948966):", Double
                        .isNaN(((Double) logFunction.evaluate(null))
                                .doubleValue()));
            } else {
                assertEquals("log of (1.5707963267948966):", (double) Math
                        .log(1.5707963267948966), ((Double) logFunction
                        .evaluate(null)).doubleValue(), 0.00001);
            }
        } catch (FactoryRegistryException e) {
            e.printStackTrace();
            fail("Unexpected exception: " + e.getMessage());
View Full Code Here

  public static Map loadFunctionNameMap() {
    functionNameMap = new HashMap();
    functionNameMap.put("", NO_OP_CAPS);
    Iterator<Function> functions = CommonFactoryFinder.getFunctions(null ).iterator();
    while ( functions.hasNext() ){
        Function exp= functions.next();
        functionNameMap.put(exp.getName().toLowerCase(), new FilterCapabilities(exp.getClass()));
    }
    return functionNameMap;
        }
View Full Code Here

            FilterFunction_rint rint = (FilterFunction_rint) ff.function("rint",
                    org.opengis.filter.expression.Expression.NIL);
            assertEquals("Name is, ", "rint", rint.getName());
            assertEquals("Number of arguments, ", 1, rint.getFunctionName().getArgumentCount());

            Function rintFunction = ff.function("rint", literal_1);
            double good0 = Math.rint(1.0);
            if (Double.isNaN(good0)) {
                assertTrue("rint of (1.0):", Double.isNaN(((Double) rintFunction
                        .evaluate(null)).doubleValue()));
            } else {
                assertEquals("rint of (1.0):", (double) Math.rint(1.0),
                        ((Double) rintFunction.evaluate(null)).doubleValue(),
                        0.00001);
            }
           
            rintFunction = ff.function("rint", literal_m1);
            double good1 = Math.rint(-1.0);
            if (Double.isNaN(good1)) {
                assertTrue("rint of (-1.0):", Double.isNaN(((Double) rintFunction
                        .evaluate(null)).doubleValue()));
            } else {
                assertEquals("rint of (-1.0):", (double) Math.rint(-1.0),
                        ((Double) rintFunction.evaluate(null)).doubleValue(),
                        0.00001);
            }
           
            rintFunction = ff.function("rint", literal_2);
            double good2 = Math.rint(2.0);
            if (Double.isNaN(good2)) {
                assertTrue("rint of (2.0):", Double.isNaN(((Double) rintFunction
                        .evaluate(null)).doubleValue()));
            } else {
                assertEquals("rint of (2.0):", (double) Math.rint(2.0),
                        ((Double) rintFunction.evaluate(null)).doubleValue(),
                        0.00001);
            }
           
            rintFunction = ff.function("rint", literal_m2);
            double good3 = Math.rint(-2.0);
            if (Double.isNaN(good3)) {
                assertTrue("rint of (-2.0):", Double.isNaN(((Double) rintFunction
                        .evaluate(null)).doubleValue()));
            } else {
                assertEquals("rint of (-2.0):", (double) Math.rint(-2.0),
                        ((Double) rintFunction.evaluate(null)).doubleValue(),
                        0.00001);
            }
           
            rintFunction = ff.function("rint", literal_pi);
            double good4 = Math.rint(Math.PI);
            if (Double.isNaN(good4)) {
                assertTrue("rint of (3.141592653589793):", Double
                        .isNaN(((Double) rintFunction.evaluate(null))
                                .doubleValue()));
            } else {
                assertEquals("rint of (3.141592653589793):", (double) Math
                        .rint(3.141592653589793), ((Double) rintFunction
                        .evaluate(null)).doubleValue(), 0.00001);
            }
           
            rintFunction = ff.function("rint", literal_05pi);
            double good5 = Math.rint(1.5707963267948966);
            if (Double.isNaN(good5)) {
                assertTrue("rint of (1.5707963267948966):", Double
                        .isNaN(((Double) rintFunction.evaluate(null))
                                .doubleValue()));
            } else {
                assertEquals("rint of (1.5707963267948966):", (double) Math
                        .rint(1.5707963267948966), ((Double) rintFunction
                        .evaluate(null)).doubleValue(), 0.00001);
            }
        } catch (FactoryRegistryException e) {
            e.printStackTrace();
            fail("Unexpected exception: " + e.getMessage());
View Full Code Here

        try {
            FilterFunction_round round = (FilterFunction_round) ff.function("round", org.opengis.filter.expression.Expression.NIL);
            assertEquals("Name is, ", "round", round.getName());
            assertEquals("Number of arguments, ", 1, round.getFunctionName().getArgumentCount());

            Function roundFunction = ff.function("round", literal_1);
            assertEquals("round of (1.0):", (int) Math.round(1.0),
                    ((Integer) roundFunction.evaluate(null)).intValue(), 0.00001);
           
            roundFunction = ff.function("round", literal_m1);
            assertEquals("round of (-1.0):", (int) Math.round(-1.0),
                    ((Integer) roundFunction.evaluate(null)).intValue(), 0.00001);
           
            roundFunction = ff.function("round", literal_2);
            assertEquals("round of (2.0):", (int) Math.round(2.0),
                    ((Integer) roundFunction.evaluate(null)).intValue(), 0.00001);
           
            roundFunction = ff.function("round", literal_m2);
            assertEquals("round of (-2.0):", (int) Math.round(-2.0),
                    ((Integer) roundFunction.evaluate(null)).intValue(), 0.00001);
           
            roundFunction = ff.function("round", literal_pi);
            assertEquals("round of (3.141592653589793):", (int) Math
                    .round(3.141592653589793), ((Integer) roundFunction
                    .evaluate(null)).intValue(), 0.00001);
           
            roundFunction = ff.function("round", literal_05pi);
            assertEquals("round of (1.5707963267948966):", (int) Math
                    .round(1.5707963267948966), ((Integer) roundFunction
                    .evaluate(null)).intValue(), 0.00001);
        } catch (FactoryRegistryException e) {
            e.printStackTrace();
            fail("Unexpected exception: " + e.getMessage());
        }
View Full Code Here

    public Subtract subtract(Expression expr1, Expression expr2) {
        return new SubtractImpl(expr1,expr2);
    }

    public Function function(String name, Expression[] args) {
        Function function = functionFinder.findFunction( name, Arrays.asList(args) );
        return function;
    }
View Full Code Here

        Function function = functionFinder.findFunction( name, Arrays.asList(args) );
        return function;
    }

    public Function function(Name name, Expression... args) {
        Function function = functionFinder.findFunction( name, Arrays.asList(args) );
        return function;
    }
View Full Code Here

        Function function = functionFinder.findFunction( name, Arrays.asList(args) );
        return function;
    }

    public Function function(String name, Expression arg1) {
        Function function = functionFinder.findFunction( name, Arrays.asList( new Expression[]{ arg1 } ) );
        return function;
    }
View Full Code Here

        Function function = functionFinder.findFunction( name, Arrays.asList( new Expression[]{ arg1 } ) );
        return function;
    }

    public Function function(String name, Expression arg1, Expression arg2) {
        Function function =
                functionFinder.findFunction( name, Arrays.asList( new Expression[]{ arg1, arg2 }) );
        return function;
    }
View Full Code Here

        return function;
    }

    /** @deprecated Pending see org.opengis.filter.Factory2 */
    public Function function(String name, List<org.opengis.filter.expression.Expression> parameters, Literal fallback ){
        Function function =
                functionFinder.findFunction( name, parameters, fallback );
       
        return function;       
    }
View Full Code Here

TOP

Related Classes of org.opengis.filter.expression.Function

Copyright © 2018 www.massapicom. 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.