@Test public void testCubicNumericInterpolation() throws Exception { setupParameters(data, values); parameters.add(ff2.literal(InterpolateFunction.METHOD_NUMERIC)); parameters.add(ff2.literal(InterpolateFunction.MODE_CUBIC)); Function fn = finder.findFunction("interpolate", parameters); double t = 0.1; Double result; double expected; for (int i = 2; i < data.length - 2; i++) { double testValue = data[i - 1] + t * (data[i] - data[i - 1]); result = fn.evaluate(feature(Double.valueOf(testValue)), Double.class); expected = cubic( testValue, new double[] {data[i - 2], data[i - 1], data[i], data[i + 1]}, new double[] {values[i - 2], values[i - 1], values[i], values[i + 1]}); assertEquals(expected, result, TOL); } result = fn.evaluate(feature(Double.valueOf(data[0] - 10)), Double.class); assertEquals(values[0], result, TOL); result = fn.evaluate(feature(Double.valueOf(data[data.length - 1] + 10)), Double.class); assertEquals(values[values.length - 1], result, TOL); }
public Object evaluate(Object object) { return evaluate(object, Object.class); }
InterpolateFunction implements Function { public Object evaluate(Object object) { return evaluate(object, Object.class); } }
InterpolateFunction implements Function { public Object evaluate(Object object) { return evaluate(object, Object.class); } InterpolateFunction();  InterpolateFunction(List<Expression> parameters, Literal fallback); }
InterpolateFunction implements Function { public Object evaluate(Object object) { return evaluate(object, Object.class); } InterpolateFunction();  InterpolateFunction(List<Expression> parameters, Literal fallback); String getName(); FunctionName getFunctionName(); List<Expression> getParameters(); Object accept(ExpressionVisitor visitor, Object extraData); Object evaluate(Object object); T evaluate(Object object, Class<T> context); Literal getFallbackValue(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
InterpolateFunction implements Function { public Object evaluate(Object object) { return evaluate(object, Object.class); } InterpolateFunction();  InterpolateFunction(List<Expression> parameters, Literal fallback); String getName(); FunctionName getFunctionName(); List<Expression> getParameters(); Object accept(ExpressionVisitor visitor, Object extraData); Object evaluate(Object object); T evaluate(Object object, Class<T> context); Literal getFallbackValue(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static final String MODE_LINEAR; static final String MODE_COSINE; static final String MODE_CUBIC; static final String METHOD_NUMERIC; static final String METHOD_COLOR; static final String RASTER_DATA; static final FunctionName NAME; }