SplitHistory implements Comparable<SplitHistory>, Serializable { public SplitHistory[] split(int num) { if (num < 2) { throw new IllegalArgumentException("num argument must be greater than 1"); } SplitHistory[] result = new SplitHistory[num]; for (int i = 0; i < num; i++) { boolean last = (i == num - 1); result[i] = split(i, last); } return result; } SplitHistory();  SplitHistory(int initialCapacity); private  SplitHistory(boolean addRoot); private  SplitHistory(int initialCapacity, boolean addRoot); int size(); List<SplitHistoryEntry> entries(); int[] indexPath(); String indexPathString(); SplitHistory[] split(int num); SplitHistory split(int index, boolean last); @Override int compareTo(SplitHistory history); boolean isPredecessor(SplitHistory history); boolean isSuccessor(SplitHistory history); boolean isFirstUpTo(int level); boolean isLastUpTo(int level); boolean isFirst(); boolean isLast(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static SplitHistory parse(String history); static final SplitHistory ROOT; }
@Test public void testSplit() { assertEquals("[(0L),(0),(0)]", new SplitHistory().split(3)[0] .split(2)[0].toString()); assertEquals("[(0L),(1),(1L)]", new SplitHistory().split(3)[1] .split(2)[1].toString()); assertEquals("[(0L),(2L),(0)]", new SplitHistory().split(3)[2] .split(2)[0].toString()); assertEquals("[(0L),(2L),(1L)]", new SplitHistory().split(3)[2] .split(2)[1].toString()); }