public Object evaluate(Object feature) { double arg0; double arg1; try { // attempt to get value and perform conversion arg0 = (getExpression(0).evaluate(feature, Double.class)).doubleValue(); } catch (Exception e) { // probably a type error throw new IllegalArgumentException( "Filter Function problem for function min argument #0 - expected type int"); } try { // attempt to get value and perform conversion arg1 = (getExpression(1).evaluate(feature, Double.class)).doubleValue(); } catch (Exception e) { // probably a type error throw new IllegalArgumentException( "Filter Function problem for function min argument #1 - expected type int"); } return new Double(Math.min(arg0, arg1)); } }
(FilterFunction_min) ff.function("min", new org.opengis.filter.expression.Expression[2]); assertEquals("Name is, ", "min", min.getName()); assertEquals("Number of arguments, ", 2, min.getFunctionName().getArgumentCount());
public Object evaluate(Object feature) { double arg0; double arg1; try { // attempt to get value and perform conversion arg0 = (getExpression(0).evaluate(feature,Double.class)).doubleValue(); } catch (Exception e) { // probably a type error throw new IllegalArgumentException( "Filter Function problem for function min argument #0 - expected type int"); } try { // attempt to get value and perform conversion arg1 = (getExpression(1).evaluate(feature,Double.class)).doubleValue(); } catch (Exception e) { // probably a type error throw new IllegalArgumentException( "Filter Function problem for function min argument #1 - expected type int"); } return new Double(Math.min(arg0, arg1)); } }
public Object evaluate(Object feature) { double arg0; double arg1; try { // attempt to get value and perform conversion arg0 = ((Number) getExpression(0).evaluate(feature)).doubleValue(); } catch (Exception e) { // probably a type error throw new IllegalArgumentException( "Filter Function problem for function min argument #0 - expected type int"); } try { // attempt to get value and perform conversion arg1 = ((Number) getExpression(1).evaluate(feature)).doubleValue(); } catch (Exception e) { // probably a type error throw new IllegalArgumentException( "Filter Function problem for function min argument #1 - expected type int"); } return new Double(Math.min(arg0, arg1)); } }