SplitParameter implements NetworkParameter, Comparable<SplitParameter> { public int compareTo(SplitParameter other) { TreatmentComparator tc = TreatmentComparator.INSTANCE; if (tc.compare(d_base, other.d_base) != 0) { return tc.compare(d_base, other.d_base); } if (tc.compare(d_subj, other.d_subj) != 0) { return tc.compare(d_subj, other.d_subj); } if (d_direct) { return other.d_direct ? 0 : -1; } else { return other.d_direct ? 1 : 0; } } SplitParameter(Treatment base, Treatment subj, boolean direct); String getName(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); int compareTo(SplitParameter other); Treatment getBaseline(); Treatment getSubject(); boolean isDirect();  }
@Test public void testCompare() { Treatment t1 = new Treatment("A_1"); Treatment t2 = new Treatment("B52"); Treatment t3 = new Treatment("C"); assertTrue(new SplitParameter(t1, t2, true).compareTo(new SplitParameter(t1, t2, true)) == 0); assertTrue(new SplitParameter(t1, t2, true).compareTo(new SplitParameter(t1, t2, false)) < 0); assertTrue(new SplitParameter(t1, t2, false).compareTo(new SplitParameter(t1, t2, true)) > 0); assertTrue(new SplitParameter(t3, t2, true).compareTo(new SplitParameter(t1, t2, true)) > 0); assertTrue(new SplitParameter(t2, t1, true).compareTo(new SplitParameter(t1, t2, true)) > 0); }