@Test public void testEqualsHashCode() { final String[] categories = {"low", "mid", "high", "super"}; final Double[] thresholds = {0.0, 50.0, 100.0}; setupParameters(categories, thresholds); parameters.add(ff2.literal("preceding")); Function fn1 = finder.findFunction("categorize", parameters); Function fn2 = finder.findFunction("categorize", parameters); thresholds[0] = -20d; setupParameters(categories, thresholds); parameters.add(ff2.literal("preceding")); Function fn3 = finder.findFunction("categorize", parameters); assertEquals(fn1, fn2); assertEquals(fn2, fn1); assertEquals(fn1.hashCode(), fn2.hashCode()); assertNotEquals(fn1, fn3); assertNotEquals(fn2, fn3); }
@Override public int hashCode() { int result = Objects.hash(parameters, fallback, staticTable, convertedValuesContext, belongsTo); result = 31 * result + Arrays.hashCode(thresholds); result = 31 * result + Arrays.hashCode(values); result = 31 * result + Arrays.hashCode(convertedValues); return result; }
CategorizeFunction implements Function { @Override public int hashCode() { int result = Objects.hash(parameters, fallback, staticTable, convertedValuesContext, belongsTo); result = 31 * result + Arrays.hashCode(thresholds); result = 31 * result + Arrays.hashCode(values); result = 31 * result + Arrays.hashCode(convertedValues); return result; } }
CategorizeFunction implements Function { @Override public int hashCode() { int result = Objects.hash(parameters, fallback, staticTable, convertedValuesContext, belongsTo); result = 31 * result + Arrays.hashCode(thresholds); result = 31 * result + Arrays.hashCode(values); result = 31 * result + Arrays.hashCode(convertedValues); return result; } CategorizeFunction();  CategorizeFunction(List<Expression> parameters, Literal fallback); }
CategorizeFunction implements Function { @Override public int hashCode() { int result = Objects.hash(parameters, fallback, staticTable, convertedValuesContext, belongsTo); result = 31 * result + Arrays.hashCode(thresholds); result = 31 * result + Arrays.hashCode(values); result = 31 * result + Arrays.hashCode(convertedValues); return result; } CategorizeFunction();  CategorizeFunction(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(); }
CategorizeFunction implements Function { @Override public int hashCode() { int result = Objects.hash(parameters, fallback, staticTable, convertedValuesContext, belongsTo); result = 31 * result + Arrays.hashCode(thresholds); result = 31 * result + Arrays.hashCode(values); result = 31 * result + Arrays.hashCode(convertedValues); return result; } CategorizeFunction();  CategorizeFunction(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 SUCCEEDING; static final String PRECEDING; static final String RASTER_DATA; static final FunctionName NAME; }