@Test public void testCompareTo() { Assert.assertEquals(0, this.testInstance.compareTo(null)); Assert.assertEquals(0, this.testInstance.compareTo(new SuggestedPhenotype(this.testID, this.testName, this.testScore))); Assert.assertEquals(0, this.testInstance.compareTo(new SuggestedPhenotype(this.testID, this.testName, this.testScore))); Assert.assertEquals(0, this.testInstance.compareTo(new SuggestedPhenotype(this.otherID, this.otherName, this.testScore))); Assert.assertEquals(-1, this.testInstance.compareTo(new SuggestedPhenotype(this.testID, this.testName, (this.testScore - 0.001)))); Assert.assertEquals(-1, this.testInstance.compareTo(new SuggestedPhenotype(this.testID, this.testName, -this.testScore))); Assert.assertEquals(-1, this.testInstance.compareTo(new SuggestedPhenotype(this.testID, this.testName, -999999))); Assert.assertEquals(1, this.testInstance.compareTo(new SuggestedPhenotype(this.testID, this.testName, 1.1))); Assert.assertEquals(1, this.testInstance.compareTo(new SuggestedPhenotype(this.testID, this.testName, 999999))); }
@Override public int compareTo(SuggestedPhenotype other) { if (other == null) { return 0; } return (int) -Math.signum(this.score - (other).getScore()); }
SuggestedPhenotype implements Comparable<SuggestedPhenotype> { @Override public int compareTo(SuggestedPhenotype other) { if (other == null) { return 0; } return (int) -Math.signum(this.score - (other).getScore()); } }
SuggestedPhenotype implements Comparable<SuggestedPhenotype> { @Override public int compareTo(SuggestedPhenotype other) { if (other == null) { return 0; } return (int) -Math.signum(this.score - (other).getScore()); } SuggestedPhenotype(String id, String name, double score); }
SuggestedPhenotype implements Comparable<SuggestedPhenotype> { @Override public int compareTo(SuggestedPhenotype other) { if (other == null) { return 0; } return (int) -Math.signum(this.score - (other).getScore()); } SuggestedPhenotype(String id, String name, double score); String getId(); String getName(); double getScore(); @Override int compareTo(SuggestedPhenotype other); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
SuggestedPhenotype implements Comparable<SuggestedPhenotype> { @Override public int compareTo(SuggestedPhenotype other) { if (other == null) { return 0; } return (int) -Math.signum(this.score - (other).getScore()); } SuggestedPhenotype(String id, String name, double score); String getId(); String getName(); double getScore(); @Override int compareTo(SuggestedPhenotype other); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }