/** * This default implementation just returns {@code this} if the number of expected parameters is * zero, otherwise throws an {@link IllegalArgumentException}. * * <p>A subclass that do expect {@link Expression} parameters shall override this method and * return a new instance of the same kind of InternalFunction configured to work against the * given {@code parameters}. * * @see * org.opengis.filter.expression.InternalFunction#duplicate(org.opengis.filter.expression.Expression[]) */ @Override public InternalFunction duplicate(Expression... parameters) { final int expectedParams = super.getParameters().size(); if (expectedParams > 0) { throw new IllegalArgumentException( "This method must be overriten by subclasses that expect Expression arguments"); } return this; }
public synchronized FunctionName getFunctionName() { if (functionName == null) { functionName = new FunctionNameImpl(name, getParameters().size()); } return functionName; }
/** * Creates a String representation of this Function with the function name and the arguments. * The String created should be good for most subclasses */ // Copied from FunctionExpressionImpl KS public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getName()); sb.append("("); List<org.opengis.filter.expression.Expression> params = getParameters(); if (params != null) { org.opengis.filter.expression.Expression exp; for (Iterator<org.opengis.filter.expression.Expression> it = params.iterator(); it.hasNext(); ) { exp = it.next(); sb.append("["); sb.append(exp); sb.append("]"); if (it.hasNext()) { sb.append(", "); } } } sb.append(")"); return sb.toString(); }
List<Expression> expr = getParameters();
public synchronized FunctionName getFunctionName() { if( functionName == null ){ functionName = new FunctionNameImpl(name,getParameters().size()); } return functionName; }
List<Expression> expr = getParameters();
/** Sets the function impl. */ private void setFunctionImpl() { FunctionImpl functionExpression = (FunctionImpl) this.expression; FunctionName functionName = functionExpression.getFunctionName(); TypeManager.getInstance().setDataType(functionName.getReturn().getType()); int maxArgument = Math.abs(functionName.getArgumentCount()); for (int index = 0; index < maxArgument; index++) { ExpressionNode childNode = new ExpressionNode(); Parameter<?> parameter = functionName.getArguments().get(0); childNode.setType(parameter.getType()); childNode.setName(parameter.getName()); if (index < functionExpression.getParameters().size()) { childNode.setExpression(functionExpression.getParameters().get(index)); } this.insert(childNode, this.getChildCount()); } }