/** * Maps the function to the native database function name * * @param function * @return */ protected String getFunctionName(Function function) { return function.getName(); }
public String getName() { return delegate.getName(); }
public Object getProperty(Object object, QName name) throws Exception { Function function = (Function) object; // <xsd:element maxOccurs="unbounded" minOccurs="0" ref="ogc:expression"/> if ("expression".equals(name.getLocalPart())) { return function.getParameters(); } // <xsd:attribute name="name" type="xsd:string" use="required"/> if ("name".equals(name.getLocalPart())) { return function.getName(); } return null; } }
Expression getParameter(Function function, int idx, boolean mandatory) { final List<Expression> params = function.getParameters(); if (params == null || params.size() <= idx) { if (mandatory) { throw new IllegalArgumentException( "Missing parameter number " + (idx + 1) + "for function " + function.getName() + ", cannot encode in SQL"); } } return params.get(idx); }
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; }
public FunctionBuilder reset(Function original) { name = original.getName(); args.clear(); args.addAll(original.getParameters()); literal.reset(original.getFallbackValue()); return this; }
public Object visit(Function expression, Object extraData) { String type = (String) "Function"; AttributesImpl atts = new AttributesImpl(); atts.addAttribute("", "name", "name", "", expression.getName()); start(type, atts); for (org.opengis.filter.expression.Expression parameter : expression.getParameters()) { parameter.accept(this, extraData); } end(type); return extraData; }
public Object visit(Function function, Object extraData) { ScalarCapabilities scalar = capabilities.getScalarCapabilities(); if (scalar == null) return false; ArithmeticOperators operators = scalar.getArithmeticOperators(); if (operators == null) return false; 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; }
public Object visit(Function function, Object extraData) { ScalarCapabilities scalar = capabilities.getScalarCapabilities(); if (scalar == null) return false; ArithmeticOperators operators = scalar.getArithmeticOperators(); if (operators == null) return false; 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; }
@Test public void testGetName() { assertEquals("getID", idExpr.getName()); }
/** Test of getName method, of class org.geotools.filter.functions.EqualIntervalFunction. */ public void testInstance() { Function equInt = ff.function("EqualInterval", org.opengis.filter.expression.Expression.NIL); assertNotNull(equInt); assertEquals("test get name", "EqualInterval", equInt.getName()); }
public void testGetName() { Function equInt = ff.function("StandardDeviation", ff.literal(FeatureCollections.newCollection())); LOGGER.finer("testGetName"); assertEquals("StandardDeviation", equInt.getName()); }
/** Test of getName method, of class org.geotools.filter.functions.UniqueIntervalFunction. */ public void testGetName() { Function equInt = ff.function("UniqueInterval", ff.literal(featureCollection)); assertEquals("UniqueInterval", equInt.getName()); }
public void testParse() throws Exception { FilterMockData.function(document, document); Function function = (Function) parse(); assertEquals("min", function.getName()); assertEquals(2, function.getParameters().size()); }
public void testGetName() { Function qInt = ff.function("Jenks", ff.literal(FeatureCollections.newCollection())); assertEquals("Jenks", qInt.getName()); }
public void testCatenateTwo() { Literal l = ff.literal("http://test?param="); PropertyName pn = ff.property("intAttribute"); Expression cat = ExpressionExtractor.catenateExpressions(Arrays.asList(l, pn)); assertTrue(cat instanceof Function); Function f = (Function) cat; assertEquals("Concatenate", f.getName()); assertEquals(l, f.getParameters().get(0)); assertEquals(pn, f.getParameters().get(1)); }
public void testGetName() { Function qInt = ff.function("Quantile", ff.literal(new DefaultFeatureCollection())); assertEquals("Quantile", qInt.getName()); }
public void testCatenateThree() { Literal l1 = ff.literal("http://test?param="); PropertyName pn = ff.property("intAttribute"); Literal l2 = ff.literal("¶m2=foo"); Expression cat = ExpressionExtractor.catenateExpressions(Arrays.asList(l1, pn, l2)); assertTrue(cat instanceof Function); Function f = (Function) cat; assertEquals("Concatenate", f.getName()); assertEquals(l1, f.getParameters().get(0)); assertEquals(pn, f.getParameters().get(1)); assertEquals(l2, f.getParameters().get(2)); } }
@Test public void testFilterFunctionNoMarker() throws Exception { String yaml = "rules: \n" + "- filter: strEndsWith(foo,'bar') = true\n"; StyledLayerDescriptor sld = Ysld.parse(yaml); Rule r = SLD.defaultStyle(sld).featureTypeStyles().get(0).rules().get(0); PropertyIsEqualTo f = (PropertyIsEqualTo) r.getFilter(); Function func = (Function) f.getExpression1(); assertEquals("strEndsWith", func.getName()); assertTrue(func.getParameters().get(0) instanceof PropertyName); assertTrue(func.getParameters().get(1) instanceof Literal); Literal lit = (Literal) f.getExpression2(); }
@Test public void testFilterFunctionWithMarker() throws Exception { String yaml = "rules: \n" + "- filter: ${strEndsWith(foo,'bar') = true}\n"; StyledLayerDescriptor sld = Ysld.parse(yaml); Rule r = SLD.defaultStyle(sld).featureTypeStyles().get(0).rules().get(0); PropertyIsEqualTo f = (PropertyIsEqualTo) r.getFilter(); Function func = (Function) f.getExpression1(); assertEquals("strEndsWith", func.getName()); assertTrue(func.getParameters().get(0) instanceof PropertyName); assertTrue(func.getParameters().get(1) instanceof Literal); Literal lit = (Literal) f.getExpression2(); }