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