CaseAmplification implements SimilarityTransform { @Override public double transformSimilarity(long id1, long id2, double value) { return value < 0.0 ? -Math.pow(-value, factor) : Math.pow(value, factor); } CaseAmplification(double factor); @Override double transformSimilarity(long id1, long id2, double value); @Override void refresh(Collection<Refreshable> alreadyRefreshed); @Override String toString();  }
@Test public void testOneValue() { assertEquals(2.0, new CaseAmplification(0.5).transformSimilarity(0, 0, 4.0), EPSILON); assertEquals(-2.0, new CaseAmplification(0.5).transformSimilarity(0, 0, -4.0), EPSILON); }