Sequence implements Comparable<Sequence> { public int compareTo(Sequence s) { if (score < s.score) return 1; if (score > s.score) return -1; return 0; } Sequence();  Sequence(Sequence s);  Sequence(Sequence s,String outcome, double p);  Sequence(List<String> outcomes); int compareTo(Sequence s); void add(String outcome, double p); List<String> getOutcomes(); double[] getProbs(); double getScore(); void getProbs(double[] ps); @Override String toString();  }
@Test public void testCompareTo() { Sequence lowScore = new Sequence(); lowScore.add("A", 1d); lowScore.add("B", 2d); lowScore.add("C", 3d); Sequence highScore = new Sequence(); lowScore.add("A", 7d); lowScore.add("B", 8d); lowScore.add("C", 9d); assertEquals(-1, lowScore.compareTo(highScore)); assertEquals(1, highScore.compareTo(lowScore)); assertEquals(0, highScore.compareTo(highScore)); }