org.opengis.filter.expression.Function.getParameters()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.opengis.filter.expression.Function.getParameters()方法的一些代码示例,展示了Function.getParameters()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Function.getParameters()方法的具体详情如下:
包路径:org.opengis.filter.expression.Function
类名称:Function
方法名:getParameters

Function.getParameters介绍

[英]Returns the list subexpressions that will be evaluated to provide the parameters to the function.
[中]

代码示例

代码示例来源:origin: geotools/geotools

public Object visit(Function expression, Object data) {
  if (expression.getParameters() != null) {
    for (Expression parameter : expression.getParameters()) {
      data = parameter.accept(this, data);
    }
  }
  return data;
}

代码示例来源:origin: geotools/geotools

public Object visit(Function expression, Object data) {
  if (expression.getParameters() != null) {
    for (Expression parameter : expression.getParameters()) {
      data = parameter.accept(this, data);
    }
  }
  return data;
}

代码示例来源:origin: geotools/geotools

/** Visit each parameter and check if they are static */
public Boolean visit(Function expression, Object data) {
  boolean isStatic = true;
  if (expression.getParameters() != null) {
    for (Expression parameter : expression.getParameters()) {
      isStatic = (Boolean) parameter.accept(this, data);
      if (isStatic == false) break;
    }
  }
  return isStatic;
}
/**

代码示例来源:origin: geotools/geotools

public Object visit(Function expression, Object data) {
  for (Expression parameter : expression.getParameters()) {
    data = parameter.accept(this, data);
  }
  return found;
}

代码示例来源:origin: geotools/geotools

public Object visit(Function expr, Object extraData) {
  for (int i = 0; i < expr.getParameters().size(); i++) {
    ((Expression) expr.getParameters().get(i)).accept(this, null);
  }
  capable = capable && fcs.supports(expr.getClass());
  return null;
}

代码示例来源:origin: geotools/geotools

public Object getProperty(Object object, QName name) throws Exception {
    Function function = (Function) object;

    // &lt;xsd:element maxOccurs="unbounded" minOccurs="0" ref="ogc:expression"/&gt;
    if ("expression".equals(name.getLocalPart())) {
      return function.getParameters();
    }

    // &lt;xsd:attribute name="name" type="xsd:string" use="required"/&gt;
    if ("name".equals(name.getLocalPart())) {
      return function.getName();
    }

    return null;
  }
}

代码示例来源:origin: geotools/geotools

@Override
public Object visit(Function expression, Object extraData) {
  // geometry manipulation functions that we have today don't mess with the
  // crs, but we might have to modify this if we get a function that
  // assigns the CRS
  for (Expression param : expression.getParameters()) {
    Object result = param.accept(this, extraData);
    if (result instanceof CoordinateReferenceSystem) {
      return result;
    }
  }
  return null;
}

代码示例来源:origin: geotools/geotools

private Object buildExists(PropertyIsEqualTo filter, StringBuilder output) {
  Function function = (Function) filter.getExpression1();
  List<Expression> parameters = function.getParameters();
  Literal arg = (Literal) parameters.get(0);
  output.append(arg.getValue());
  output.append(" EXISTS");
  return output;
}

代码示例来源:origin: geotools/geotools

public Object visit(Function expression, Object data) {
  if (found(data)) return data;
  if (expression.getParameters() != null) {
    for (Expression parameter : expression.getParameters()) {
      data = parameter.accept(this, data);
      if (found(data)) return data;
    }
  }
  return data;
}

代码示例来源:origin: geotools/geotools

public FunctionBuilder reset(Function original) {
  name = original.getName();
  args.clear();
  args.addAll(original.getParameters());
  literal.reset(original.getFallbackValue());
  return this;
}

代码示例来源:origin: geotools/geotools

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;
}

代码示例来源:origin: geotools/geotools

@Test
  public void testGetArgs() {
    assertNotNull(idExpr.getParameters());
    assertEquals(0, idExpr.getParameters().size());
  }
}

代码示例来源:origin: geotools/geotools

@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);
  }
  return null;
}

代码示例来源:origin: geotools/geotools

public void testIntersectsFilterFunctionUnreferencedGeometry() throws Exception {
  GeometryFactory gf = new GeometryFactory();
  LineString ls =
      gf.createLineString(
          new Coordinate[] {new Coordinate(10, 15), new Coordinate(20, 25)});
  Function intersects = ff.function("intersects", ff.property("geom"), ff.literal(ls));
  Function clone = (Function) intersects.accept(reprojector, null);
  assertNotSame(intersects, clone);
  assertEquals(clone.getParameters().get(0), intersects.getParameters().get(0));
  assertEquals(clone.getParameters().get(1), intersects.getParameters().get(1));
}

代码示例来源:origin: geotools/geotools

public void testCatenateThree() {
    Literal l1 = ff.literal("http://test?param=");
    PropertyName pn = ff.property("intAttribute");
    Literal l2 = ff.literal("&param2=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));
  }
}

代码示例来源:origin: geotools/geotools

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));
}

代码示例来源:origin: geotools/geotools

@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();
}

代码示例来源:origin: geotools/geotools

@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();
}

代码示例来源:origin: geotools/geotools

public void testCountFunctionDescription() throws Exception {
  // Create instance of function to get hold of the filter capabilities
  PropertyName exp = ff.property("foo");
  Function func = ff.function("Collection_Count", exp);
  // Expecting one function parameter
  assertEquals(func.getParameters().size(), 1);
  // Test return parameter
  assertEquals(func.getFunctionName().getReturn().toString(), "count:Number");
}

代码示例来源:origin: geotools/geotools

public void testParse() throws Exception {
  FilterMockData.function(document, document);
  Function function = (Function) parse();
  assertEquals("min", function.getName());
  assertEquals(2, function.getParameters().size());
}

相关文章