private SortedSet getSubSet(SortedSet set) { Object[] elements = AbstractTestSortedSet.this.getFullElements(); switch (m_Type) { case TYPE_SUBSET : return set.subSet(elements[m_LowBound], elements[m_HighBound]); case TYPE_HEADSET : return set.headSet(elements[m_HighBound]); case TYPE_TAILSET : return set.tailSet(elements[m_LowBound]); default : return null; } }
/** * Bulk test {@link SortedSet#subSet(Object, Object)}. This method runs through all of * the tests in {@link AbstractTestSortedSet}. * After modification operations, {@link #verify()} is invoked to ensure * that the set and the other collection views are still valid. * * @return a {@link AbstractTestSet} instance for testing a subset. */ public BulkTest bulkTestSortedSetSubSet() { int length = getFullElements().length; int lobound = length / 3; int hibound = lobound * 2; return new TestSortedSetSubSet(lobound, hibound); }
/** * Bulk test {@link SortedSet#headSet(Object)}. This method runs through all of * the tests in {@link AbstractTestSortedSet}. * After modification operations, {@link #verify()} is invoked to ensure * that the set and the other collection views are still valid. * * @return a {@link AbstractTestSet} instance for testing a headset. */ public BulkTest bulkTestSortedSetHeadSet() { int length = getFullElements().length; int lobound = length / 3; int hibound = lobound * 2; return new TestSortedSetSubSet(hibound, true); }
/** * Bulk test {@link SortedSet#tailSet(Object)}. This method runs through all of * the tests in {@link AbstractTestSortedSet}. * After modification operations, {@link #verify()} is invoked to ensure * that the set and the other collection views are still valid. * * @return a {@link AbstractTestSet} instance for testing a tailset. */ public BulkTest bulkTestSortedSetTailSet() { int length = getFullElements().length; int lobound = length / 3; return new TestSortedSetSubSet(lobound, false); }
public TestSortedSetSubSet(int lobound, int hibound) { super("TestSortedSetSubSet"); //System.out.println("SUBSET"); m_Type = TYPE_SUBSET; m_LowBound = lobound; m_HighBound = hibound; int length = hibound - lobound; //System.out.println("Low=" + lobound + "::High=" + hibound + "::Length=" + length); m_FullElements = new Object[length]; System.arraycopy(AbstractTestSortedSet.this.getFullElements(), lobound, m_FullElements, 0, length); m_OtherElements = new Object[length - 1]; System.arraycopy(//src src_pos dst dst_pos length AbstractTestSortedSet.this.getOtherElements(), lobound, m_OtherElements, 0, length - 1); //System.out.println(new TreeSet(Arrays.asList(m_FullElements))); //System.out.println(new TreeSet(Arrays.asList(m_OtherElements))); }
m_HighBound = bound; m_FullElements = new Object[bound]; System.arraycopy(AbstractTestSortedSet.this.getFullElements(), 0, m_FullElements, 0, bound); m_OtherElements = new Object[bound - 1]; Object[] allelements = AbstractTestSortedSet.this.getFullElements();