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

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

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

Function.getFunctionName介绍

[英]Access to the FunctionName description as used in a FilterCapabilities document.
[中]

代码示例

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

public FunctionName getFunctionName() {
    return delegate.getFunctionName();
  }
}

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

protected Class getFunctionReturnType(Function f) {
  Class clazz = Object.class;
  if (f.getFunctionName() != null && f.getFunctionName().getReturn() != null) {
    clazz = f.getFunctionName().getReturn().getType();
  }
  if (clazz == Object.class) {
    clazz = null;
  }
  return clazz;
}

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

private Class<?> getFunctionReturnType(Function f) {
  Class<?> clazz = Object.class;
  if (f.getFunctionName() != null && f.getFunctionName().getReturn() != null) {
    clazz = f.getFunctionName().getReturn().getType();
  }
  if (clazz == Object.class) {
    clazz = null;
  }
  return clazz;
}

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

@Override
public Object visit(Function expression, Object extraData) {
  FunctionName name = expression.getFunctionName();
  if (name != null && name.getReturn() != null) {
    return name.getReturn().getType();
  } else {
    return Object.class;
  }
}

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

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

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

List<Parameter<?>> arguments = function.getFunctionName().getArguments();
Parameter<?> lastArgument =
    arguments.isEmpty() ? null : arguments.get(arguments.size() - 1);

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

@Override
public Object visit(Function expression, Object extraData) {
  List old = expression.getParameters();
  FunctionName functionName = expression.getFunctionName();
  List<Parameter<?>> arguments = null;
  if (functionName != null) {
    arguments = functionName.getArguments();
  }
  Expression[] args = new Expression[old.size()];
  for (int i = 0; i < old.size(); i++) {
    Expression exp = (Expression) old.get(i);
    if (arguments != null && i < arguments.size()) {
      args[i] = optimize(exp, extraData, arguments.get(i).getType());
    } else {
      args[i] = visit(exp, extraData);
    }
  }
  Function duplicate;
  if (expression instanceof InternalFunction) {
    duplicate = ((InternalFunction) expression).duplicate(args);
  } else {
    duplicate = getFactory(extraData).function(expression.getName(), args);
  }
  return duplicate;
}

代码示例来源: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 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: org.geotools/gt-main

public FunctionName getFunctionName() {
    return delegate.getFunctionName();
  }
}

代码示例来源:origin: org.geotools/gt-jdbc

Class getFunctionReturnType(Function f) {
  Class clazz = Object.class;
  if (f.getFunctionName() != null && f.getFunctionName().getReturn() != null) {
    clazz = f.getFunctionName().getReturn().getType();
  }
  if (clazz == Object.class) {
    clazz = null;
  }
  return clazz;
}

代码示例来源:origin: org.geotools/gt-main

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;
    if( function instanceof FunctionExpression ){
      argc = ((FunctionExpression)function).getArgCount();
    }
    else {
      argc = function.getParameters().size();
    }
    functionName = filterFactory.functionName(name, argc );
  }
  else {
    if( !functionName.getName().equals(name )){
      LOGGER.warning( function.getClass() +" has name conflict betwee '"+name+"' and '"+functionName.getName()+"'");
    }
  }
  return functionName;
}
private Map<Name,FunctionDescriptor> loadFunctions() {

代码示例来源:origin: org.geoserver/gs-wms

/**
 * Returns the function return type, or {@link Object} if it could not be determined
 *
 * @param f
 */
Class getFunctionReturnType(Function f) {
  FunctionName name = f.getFunctionName();
  if (name == null || name.getReturn() == null) {
    return Object.class;
  }
  return name.getReturn().getType();
}

代码示例来源:origin: org.geotools/gt-jdbc

Expression e = parameters.get( i );
Object context = function.getFunctionName().getArguments().get(i).getType();
e.accept(this, context);

代码示例来源:origin: org.geotools/gt-css

@Override
public Object visit(Function expression, Object data) {
  FunctionName name = expression.getFunctionName();
  if (name != null && name.getArgumentCount() > 0) {
    List<Parameter<?>> argumentTypes = name.getArguments();
    List<Expression> arguments = expression.getParameters();
    for (int i = 0; i < Math.min(arguments.size(), argumentTypes.size()); i++) {
      Expression ex = arguments.get(i);
      String propertyName = getPropertyName(ex);
      Parameter<?> argumentType = argumentTypes.get(i);
      if (propertyName != null && argumentType != null) {
        aggregator.addType(propertyName, argumentType.getType());
      }
    }
  }
  return super.visit(expression, data);
}

代码示例来源:origin: robward-scisys/sldeditor

/**
 * Extract function attribute.
 *
 * @param foundList the found list
 * @param function the function
 * @return the class
 */
private Class<?> extractFunctionAttribute(List<String> foundList, Function function) {
  Class<?> returnType;
  FunctionName functionName = function.getFunctionName();
  List<Parameter<?>> argumentList = functionName.getArguments();
  int index = 0;
  for (Expression parameterExpression : function.getParameters()) {
    Parameter<?> parameter = argumentList.get(index);
    extractAttribute(parameter.getType(), parameterExpression, foundList);
    if (index < argumentList.size()) {
      index++;
    }
    if (index >= argumentList.size()) {
      index = argumentList.size() - 1;
    }
  }
  returnType = functionName.getReturn().getType();
  return returnType;
}

代码示例来源:origin: org.geotools/gt-transform

@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: robward-scisys/sldeditor

} else if (expression instanceof Function) {
  Function functionExpression = (Function) expression;
  FunctionName function = functionExpression.getFunctionName();

代码示例来源:origin: robward-scisys/sldeditor

/** Sets the function. */
private void setFunction() {
  Function functionExpression = (Function) this.expression;
  FunctionName functionName = functionExpression.getFunctionName();
  TypeManager.getInstance().setDataType(functionName.getReturn().getType());
  int overallIndex = 0;
  for (Parameter<?> param : functionName.getArguments()) {
    if (param.getMinOccurs() == 0) {
      overallIndex = setFunctionOptional(functionExpression, overallIndex, param);
    } else {
      overallIndex = setFunctionFixed(functionExpression, overallIndex, param);
    }
  }
}

代码示例来源:origin: org.geoserver/gs-wms

if (tx instanceof Function) {
  Function f = (Function) tx;
  FunctionName name = f.getFunctionName();
  if (name != null) {
    Parameter<?> result = name.getReturn();

相关文章