Package org.opengis.filter.capability

Examples of org.opengis.filter.capability.FunctionName


public class FunctionExpressionImplTest {

    @Test
    public void testVariableArgCount() {
        FunctionName name = new FunctionNameImpl(
                "test",
                parameter("result", Double.class),
                parameter("double",Double.class,2,Integer.MAX_VALUE));

        FunctionExpressionImpl f = new FunctionExpressionImpl(name) {
View Full Code Here


        assertEquals(-2, f.getFunctionName().getArgumentCount());
    }
   
    @Test
    public void testHigherCardinality() {
        FunctionName name = new FunctionNameImpl(
                "test",
                parameter("result", Double.class),
                parameter("double",Double.class,2,2));

        FunctionExpressionImpl f = new FunctionExpressionImpl(name) {
View Full Code Here

        assertEquals(2, f.getFunctionName().getArgumentCount());
    }
   
    @Test
    public void testSimpleArguments() {
        FunctionName name = new FunctionNameImpl(
                "test",
                parameter("result", Double.class),
                parameter("one",Double.class),
                parameter("two",Double.class));
View Full Code Here

        return functionCache;
    }
   
    private FunctionName getFunctionName( Function function ){
        String name = function.getName();
        FunctionName functionName = function.getFunctionName();
       
        if( functionName == null && function instanceof FunctionExpressionImpl){
            functionName = function.getFunctionName();
        }
        if( functionName == null ){
            int argc;
            argc = function.getParameters().size();
            functionName = filterFactory.functionName(name, argc );
            if( !functionName.getName().equals(name )){
                LOGGER.warning( function.getClass() +" FunctionName was null, used for etArgumentCount(): "+functionName );
            }
        }
        else {
            if( !functionName.getName().equals(name )){
                LOGGER.warning( function.getClass() +" has name conflict betwee '"+name+"' and '"+functionName.getName()+"'");
            }
        }
        return functionName;
    }
View Full Code Here

        Map<Name,FunctionDescriptor> functionMap = new HashMap<Name,FunctionDescriptor>();

        Set<Function> functions = CommonFactoryFinder.getFunctions(null);
        for (Iterator<Function> i = functions.iterator(); i.hasNext();) {
            Function function = (Function) i.next();
            FunctionName functionName = getFunctionName( function );
            Name name = functionName.getFunctionName();

            FunctionDescriptor fd = new FunctionDescriptor( functionName, (Class<Function>) function.getClass() );

            // needed to insert justin's name hack here to ensure consistent lookup
            Name key = functionName(name);
View Full Code Here

                        List<org.opengis.parameter.Parameter<?>> args = new ArrayList<org.opengis.parameter.Parameter<?>>( argumentNames.size() );
                        for(String argumentName : argumentNames ){
                            args.add( parameterInfo.get(argumentName));
                        }

                        FunctionName functionName = new FunctionNameImpl(processName, result, args);
                        functionNames.add(functionName);
                        processToFunction.put(processName, functionName);
                    }
                }
            }
View Full Code Here

                .literal(BufferFeatureCollectionFactory.BUFFER.key), ff.literal(1000));
        // build the function and call it
        Function buffer = ff.function("gt:BufferFeatureCollection", featuresParam, bufferParam);
       
        // check the metadata
        FunctionName fn = buffer.getFunctionName();
        assertEquals("gt:BufferFeatureCollection", fn.getName());
        assertEquals(2, fn.getArgumentCount());
        assertEquals(FeatureCollection.class, fn.getReturn().getType());
       
        // run and check results
        SimpleFeatureCollection buffered = (SimpleFeatureCollection) buffer.evaluate(features);
        assertEquals(features.size(), buffered.size());
        GeometryDescriptor gd = buffered.getSchema().getGeometryDescriptor();
View Full Code Here

       
        Functions functions = operators.getFunctions();
        if( functions == null ) return false;
       
        // Note that only function name is checked here
        FunctionName found = functions.getFunctionName( function.getName() );
        // And that's enough to assess if the function is supported
        return found != null;
    }
View Full Code Here

            for (String file : filterRoot.list()) {
                if (file.endsWith(".py")) {
                    PythonFilterFunctionAdapter adapter =
                        new PythonFilterFunctionAdapter(new File(filterRoot, file), py);
                    for(String name : adapter.getNames()) {
                        FunctionName fname =
                            ff.functionName(name, adapter.getParameterNames(name).size());
                        names.add(fname);
                    }
                }
            }
View Full Code Here

             
                Set<FunctionName> functions = getAvailableFunctionNames();
                Iterator it = functions.iterator();

                while (it.hasNext()) {
                    FunctionName fname = (FunctionName) it.next();
                    AttributesImpl atts = new AttributesImpl();
                    atts.addAttribute("", "nArgs", "nArgs", "", fname.getArgumentCount() + "");

                    element(prefix + "Function_Name", fname.getName(), atts);
                }

                end(prefix + "Function_Names");
                end(prefix + "Functions");
            }
View Full Code Here

TOP

Related Classes of org.opengis.filter.capability.FunctionName

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.