Examples of FunctionName


Examples of org.opengis.filter.capability.FunctionName

        return factory.functionName(name, Integer.parseInt(nargs));
    }

    public Element encode(Object object, Document document, Element value)
        throws Exception {
        FunctionName function = (FunctionName) object;
        value.appendChild(document.createTextNode(function.getName()));
        value.setAttributeNS("", "nArgs", function.getArgumentCount() + "");

        return value;
    }
View Full Code Here

Examples of org.opengis.filter.capability.FunctionName

    }

    public void testParse() throws Exception {
        FilterMockData.functionName(document, document);

        FunctionName function = (FunctionName) parse(OGC.Function_NameType);
        assertEquals("foo", function.getName());
        assertEquals(2, function.getArgumentCount());
    }
View Full Code Here

Examples of org.opengis.filter.capability.FunctionName

        assertEquals("foo", function.getName());
        assertEquals(2, function.getArgumentCount());
    }

    public void testEncode() throws Exception {
        FunctionName function = FilterMockData.functionName();
        Document dom = encode(function, new QName(OGC.NAMESPACE, "Function"), OGC.Function_NameType);

        assertEquals("foo", dom.getDocumentElement().getFirstChild().getNodeValue());
        assertEquals("2", dom.getDocumentElement().getAttribute("nArgs"));
    }
View Full Code Here

Examples of org.opengis.filter.capability.FunctionName

       
        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

Examples of org.opengis.filter.capability.FunctionName

        return null;
    }

    @Override
    public Object visit(Function f, Object extraData) {
        FunctionName fn = f.getFunctionName();
        if (fn != null && fn.getReturn() != null && fn.getReturn().getType() != Object.class) {
            return fn.getReturn().getType();
        } else if (f instanceof FilterFunction_Convert) {
            // special case for the convert function, which has the return type as
            // a parameter
            return f.getParameters().get(1).evaluate(null, Class.class);
        }
View Full Code Here

Examples of org.opengis.filter.capability.FunctionName

* @source $URL$
*/
public class FunctionImplTest extends TestCase {

    public void testFunctionName() throws Exception {
        FunctionName fn = FunctionImpl.functionName("foo", "bar:Integer", "a", "x:String:1,1",
            "y:MultiPolygon", "z:java.util.Date:1,");
       
        assertEquals("foo", fn.getName());
        check(fn.getReturn(), "bar", Integer.class, 1, 1);
        check(fn.getArguments().get(0), "a", Object.class, 1, 1);
        check(fn.getArguments().get(1), "x", String.class, 1, 1);
        check(fn.getArguments().get(2), "y", MultiPolygon.class, 1, 1);
        check(fn.getArguments().get(3), "z", Date.class, 1, -1);
       
        fn = FunctionImpl.functionName("foo", "a", "geom::1,1", "b:Object:,");
        check(fn.getArguments().get(0), "geom", Geometry.class, 1, 1);
        check(fn.getArguments().get(1), "b", Object.class, -1, -1);
       
        fn = FunctionImpl.functionName("foo", "value", "geom::,");
        check(fn.getArguments().get(0), "geom", Geometry.class, -1, -1);
    }
View Full Code Here

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

Examples of org.opengis.filter.capability.FunctionName

        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

Examples of org.opengis.filter.capability.FunctionName

        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

Examples of org.opengis.filter.capability.FunctionName

        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
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.