/** * Utility method for subclasses to ask for an argument at a given index * * @param index * @return */ protected org.opengis.filter.expression.Expression getExpression(int index) { org.opengis.filter.expression.Expression exp; exp = getParameters().get(index); return exp; }
/** * Creates a String representation of this Function with the function name and the arguments. * The String created should be good for most subclasses */ public String toString() { StringBuffer sb = new StringBuffer(); 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(); }
public void testGetParameters() { final List expected = Collections.singletonList(new LiteralExpressionImpl(10d)); // do not try this at home function.params = expected; assertEquals(expected, function.getParameters()); }
public void testGetArgs() { final List expected = Collections.singletonList(new LiteralExpressionImpl(10d)); function.setParameters(expected); List<Expression> actual = function.getParameters(); assertEquals(expected, actual); }
/** * Utility method for subclasses to ask for an argument at a given index * * @param index * @return */ protected org.opengis.filter.expression.Expression getExpression(int index){ org.opengis.filter.expression.Expression exp; exp = (org.opengis.filter.expression.Expression) getParameters().get(index); return exp; }
/** * Utility method for subclasses to ask for an argument at a given index * * @param index * @return */ protected org.opengis.filter.expression.Expression getExpression(int index){ org.opengis.filter.expression.Expression exp; exp = (org.opengis.filter.expression.Expression) getParameters().get(index); return exp; }
/** * Since this class is heavily subclasses within the geotools toolkit * itself we relax the 'final' restriction of this deprecated method. * * @deprecated use {@link #getParameters()}. * */ public Expression[] getArgs() { List params = getParameters(); return (Expression[])params.toArray(new Expression[params.size()]); }
/** * Since this class is heavily subclasses within the geotools toolkit * itself we relax the 'final' restriction of this deprecated method. * * @deprecated use {@link #getParameters()}. * */ public Expression[] getArgs() { List params = getParameters(); return (Expression[])params.toArray(new Expression[params.size()]); }
/** * Creates a String representation of this Function with * the function name and the arguments. The String created * should be good for most subclasses */ public String toString(){ StringBuffer sb = new StringBuffer(); 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(); }
/** * Creates a String representation of this Function with * the function name and the arguments. The String created * should be good for most subclasses */ public String toString(){ StringBuffer sb = new StringBuffer(); sb.append(getName()); sb.append("("); List params = getParameters(); if(params != null){ org.opengis.filter.expression.Expression exp; for(Iterator it = params.iterator(); it.hasNext();){ exp = (Expression) it.next(); sb.append("["); sb.append(exp); sb.append("]"); if(it.hasNext()){ sb.append(", "); } } } sb.append(")"); return sb.toString(); }
/** * The missing toString() method. * * @param expression the expression * @return the string */ private static String missingToString(FunctionExpressionImpl expression) { StringBuilder sb = new StringBuilder(); sb.append(expression.getName()); sb.append("("); List<org.opengis.filter.expression.Expression> params = expression.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(); }
public boolean equals(Object obj) { if( obj == null || !(obj instanceof Function)){ return false; } Function other = (Function) obj; if( ( getName() == null && other.getName() != null ) || (getName() != null && !getName().equalsIgnoreCase( other.getName() ))){ return false; } if( getParameters() == null && other.getClass() != null ){ return false; } return getParameters() != null && getParameters().equals( other.getParameters() ); } }
public boolean equals(Object obj) { if( obj == null || !(obj instanceof Function)){ return false; } Function other = (Function) obj; if( ( getName() == null && other.getName() != null ) || (getName() != null && !getName().equalsIgnoreCase( other.getName() ))){ return false; } if( getParameters() == null && other.getClass() != null ){ return false; } return getParameters() != null && getParameters().equals( other.getParameters() ); } }