@Test public void chooseBetter_matchStrength_diff_1() { AffMatchResult affMatchResult1 = new AffMatchResult(affiliation, organization_A, 0.8f); AffMatchResult affMatchResult2 = new AffMatchResult(affiliation, organization_B, 0.7f); assertTrue(affMatchResult1 == chooser.chooseBetter(affMatchResult1, affMatchResult2)); }
public AffMatchResult chooseBetter(AffMatchResult affMatchResult1, AffMatchResult affMatchResult2) { Preconditions.checkNotNull(affMatchResult1); Preconditions.checkNotNull(affMatchResult2); if (Math.abs(affMatchResult1.getMatchStrength() - affMatchResult2.getMatchStrength()) < EPSILON) { return affMatchResult1; } if (affMatchResult1.getMatchStrength() > affMatchResult2.getMatchStrength()) { return affMatchResult1; } return affMatchResult2; }
AffMatchResultChooser implements Serializable { public AffMatchResult chooseBetter(AffMatchResult affMatchResult1, AffMatchResult affMatchResult2) { Preconditions.checkNotNull(affMatchResult1); Preconditions.checkNotNull(affMatchResult2); if (Math.abs(affMatchResult1.getMatchStrength() - affMatchResult2.getMatchStrength()) < EPSILON) { return affMatchResult1; } if (affMatchResult1.getMatchStrength() > affMatchResult2.getMatchStrength()) { return affMatchResult1; } return affMatchResult2; } }
AffMatchResultChooser implements Serializable { public AffMatchResult chooseBetter(AffMatchResult affMatchResult1, AffMatchResult affMatchResult2) { Preconditions.checkNotNull(affMatchResult1); Preconditions.checkNotNull(affMatchResult2); if (Math.abs(affMatchResult1.getMatchStrength() - affMatchResult2.getMatchStrength()) < EPSILON) { return affMatchResult1; } if (affMatchResult1.getMatchStrength() > affMatchResult2.getMatchStrength()) { return affMatchResult1; } return affMatchResult2; }  }
AffMatchResultChooser implements Serializable { public AffMatchResult chooseBetter(AffMatchResult affMatchResult1, AffMatchResult affMatchResult2) { Preconditions.checkNotNull(affMatchResult1); Preconditions.checkNotNull(affMatchResult2); if (Math.abs(affMatchResult1.getMatchStrength() - affMatchResult2.getMatchStrength()) < EPSILON) { return affMatchResult1; } if (affMatchResult1.getMatchStrength() > affMatchResult2.getMatchStrength()) { return affMatchResult1; } return affMatchResult2; }  AffMatchResult chooseBetter(AffMatchResult affMatchResult1, AffMatchResult affMatchResult2); }
AffMatchResultChooser implements Serializable { public AffMatchResult chooseBetter(AffMatchResult affMatchResult1, AffMatchResult affMatchResult2) { Preconditions.checkNotNull(affMatchResult1); Preconditions.checkNotNull(affMatchResult2); if (Math.abs(affMatchResult1.getMatchStrength() - affMatchResult2.getMatchStrength()) < EPSILON) { return affMatchResult1; } if (affMatchResult1.getMatchStrength() > affMatchResult2.getMatchStrength()) { return affMatchResult1; } return affMatchResult2; }  AffMatchResult chooseBetter(AffMatchResult affMatchResult1, AffMatchResult affMatchResult2);  }