public Object evaluate(Object feature) { double arg0; 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 toDegrees argument #0 - expected type double"); } return new Double(Math.toDegrees(arg0)); } }
public Object evaluate(Object feature) { double arg0; 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 toRadians argument #0 - expected type double"); } return new Double(Math.toRadians(arg0)); } }
public Object evaluate(Object feature) { double arg0; 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 abs argument #0 - expected type double"); } return new Double(Math.abs(arg0)); } }
public void testrandom() { try { FilterFunction_random randomFunction = (FilterFunction_random) ff.function("random", new org.opengis.filter.expression.Expression[0]); assertEquals("Name is, ", "random", randomFunction.getName()); assertEquals( "Number of arguments, ", 0, randomFunction.getFunctionName().getArgumentCount()); } catch (FactoryRegistryException e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); fail("Unexpected exception: " + e.getMessage()); } }
public void testModuloInvalidInitNoArgs() { try { ff.function(functionName); } catch (RuntimeException e) { assertEquals("Unable to find function " + functionName, e.getMessage()); return; } fail("Exception not thrown"); }
public Object evaluate(Object feature) { double arg0; 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 acos argument #0 - expected type double"); } return new Double(Math.acos(arg0)); } }
public Object evaluate(Object feature) { double arg0; 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 exp argument #0 - expected type double"); } return new Double(Math.exp(arg0)); } }
public Object evaluate(Object feature) { double arg0; 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 ceil argument #0 - expected type double"); } return new Double(Math.ceil(arg0)); } }
public Object evaluate(Object feature) { double arg0; 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 atan argument #0 - expected type double"); } return new Double(Math.atan(arg0)); } }
public void testModuloNegativeDividend() { Function function = ff.function(functionName, ff.literal(-13), ff.literal(4)); assertEquals(3, function.evaluate(null)); }
public void testToLowerCase() { FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); Function f = ff.function("strToLowerCase", ff.literal("UPCASE")); assertEquals("upcase", f.evaluate(null)); }
public Object evaluate(Object object) { return evaluate(object, functionName.getReturn().getType()); }
public void testModuloZeroDivisor() { Function function = ff.function(functionName, ff.literal(13), ff.literal(0)); try { function.evaluate(null); } catch (IllegalArgumentException e) { return; } fail("IllegalArgumentException not thrown"); } }
public void testModuloInvalidInitOneArg() { try { ff.function(functionName, ff.literal(13)); } catch (RuntimeException e) { assertEquals("Unable to find function " + functionName, e.getMessage()); return; } fail("Exception not thrown"); }
public void testModuloNegativeDivisor() { Function function = ff.function(functionName, ff.literal(13), ff.literal(-4)); assertEquals(-3, function.evaluate(null)); }
public void testToUpperCase() { FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); Function f = ff.function("strToUpperCase", ff.literal("lowcase")); assertEquals("LOWCASE", f.evaluate(null)); } }
public void testModuloInvalidInitThreeArgs() { try { ff.function(functionName, ff.literal(13), ff.literal(14), ff.literal(15)); } catch (RuntimeException e) { assertEquals("Unable to find function " + functionName, e.getMessage()); return; } fail("Exception not thrown"); }
public void testModuloOneDivisor() { Function function = ff.function(functionName, ff.literal(13), ff.literal(1)); assertEquals(0, function.evaluate(null)); }
public void testModuloFloat() { Function function = ff.function(functionName, ff.literal(13.6), ff.literal(4)); assertEquals(1, function.evaluate(null)); }
public void testModulo() { Function function = ff.function(functionName, ff.literal(13), ff.literal(4)); assertEquals(1, function.evaluate(null)); }