assertEquals(2, cs.getNumberOfRegions());
assertEquals("[49, 59]", Arrays.toString(regions.next()));
assertEquals("[69, 79]", Arrays.toString(regions.next()));
+ assertEquals(22, cs.getSize());
cs.hideColumns(48, 80);
regions = cs.iterator();
assertEquals(1, cs.getNumberOfRegions());
assertEquals("[48, 80]", Arrays.toString(regions.next()));
+ assertEquals(33, cs.getSize());
/*
* another...joining hidden ranges
regions = cs.iterator();
assertEquals(1, cs.getNumberOfRegions());
assertEquals("[10, 60]", Arrays.toString(regions.next()));
+ assertEquals(51, cs.getSize());
/*
* another...left overlap, subsumption, right overlap,
assertEquals(2, cs.getNumberOfRegions());
assertEquals("[10, 50]", Arrays.toString(regions.next()));
assertEquals("[60, 70]", Arrays.toString(regions.next()));
+ assertEquals(52, cs.getSize());
}
@Test(groups = { "Functional" })
cs = new HiddenColumns();
cs.hideColumns(one);
assertEquals(1, cs.getNumberOfRegions());
+ assertEquals(1, cs.getSize());
one.set(2);
cs = new HiddenColumns();
cs.hideColumns(one);
assertEquals(1, cs.getNumberOfRegions());
+ assertEquals(2, cs.getSize());
one.set(3);
cs = new HiddenColumns();
cs.hideColumns(one);
assertEquals(1, cs.getNumberOfRegions());
+ assertEquals(3, cs.getSize());
// split
one.clear(2);
cs = new HiddenColumns();
cs.hideColumns(one);
assertEquals(2, cs.getNumberOfRegions());
+ assertEquals(2, cs.getSize());
assertEquals(0, cs.visibleToAbsoluteColumn(0));
assertEquals(2, cs.visibleToAbsoluteColumn(1));
one.clear(1);
cs = new HiddenColumns();
cs.hideColumns(one);
+ assertEquals(1, cs.getSize());
assertEquals(1, cs.getNumberOfRegions());
}
@Test(groups = { "Functional" })
- public void hideColumns_BitSetAndRange()
- {
- HiddenColumns hc = new HiddenColumns();
- hc.hideColumns(3, 5);
- hc.hideColumns(15, 20);
- hc.hideColumns(45, 60);
-
- BitSet tohide = new BitSet();
-
- // all unhidden if tohide is empty and range covers hidden
- hc.hideColumns(tohide, 1, 70);
- assertTrue(!hc.hasHiddenColumns());
- assertEquals(0, hc.getSize());
-
- hc.hideColumns(3, 5);
- hc.hideColumns(15, 20);
- hc.hideColumns(45, 60);
- assertEquals(25, hc.getSize());
-
- // but not if range does not cover hidden
- hc.hideColumns(tohide, 23, 40);
- assertTrue(hc.hasHiddenColumns());
- assertEquals(25, hc.getSize());
-
- // and partial unhide if range partially covers
- hc.hideColumns(tohide, 1, 17);
- Iterator<int[]> it = hc.iterator();
- assertTrue(it.hasNext());
- int[] region = it.next();
-
- assertEquals(18, region[0]);
- assertEquals(20, region[1]);
-
- assertTrue(it.hasNext());
- region = it.next();
-
- assertEquals(45, region[0]);
- assertEquals(60, region[1]);
-
- assertFalse(it.hasNext());
- assertEquals(19, hc.getSize());
- }
-
- @Test(groups = { "Functional" })
public void testRegionsToString()
{
HiddenColumns hc = new HiddenColumns();
h.hideList(seq2.getInsertions());
assertTrue(h.equals(h2));
+ assertEquals(0, h.getSize());
h.hideList(seq1.getInsertions());
h2.hideColumns(3, 5);
h2.hideColumns(9, 9);
h2.hideColumns(19, 20);
assertTrue(h.equals(h2));
+ assertEquals(6, h.getSize());
}
@Test(groups = "Functional")
h2.hideColumns(25, 27);
assertTrue(h.equals(h2));
assertEquals(h.getSize(), h2.getSize());
+
+ HiddenColumns hc = new HiddenColumns();
+ hc.hideColumns(3, 5);
+ hc.hideColumns(15, 20);
+ hc.hideColumns(45, 60);
+
+ tohide = new BitSet();
+
+ // all unhidden if tohide is empty and range covers hidden
+ hc.hideColumns(tohide, 1, 70);
+ assertTrue(!hc.hasHiddenColumns());
+ assertEquals(0, hc.getSize());
+
+ hc.hideColumns(3, 5);
+ hc.hideColumns(15, 20);
+ hc.hideColumns(45, 60);
+ assertEquals(25, hc.getSize());
+
+ // but not if range does not cover hidden
+ hc.hideColumns(tohide, 23, 40);
+ assertTrue(hc.hasHiddenColumns());
+ assertEquals(25, hc.getSize());
+
+ // and partial unhide if range partially covers
+ hc.hideColumns(tohide, 1, 17);
+ Iterator<int[]> it = hc.iterator();
+ assertTrue(it.hasNext());
+ int[] region = it.next();
+
+ assertEquals(18, region[0]);
+ assertEquals(20, region[1]);
+
+ assertTrue(it.hasNext());
+ region = it.next();
+
+ assertEquals(45, region[0]);
+ assertEquals(60, region[1]);
+
+ assertFalse(it.hasNext());
+ assertEquals(19, hc.getSize());
}
@Test(groups = "Functional")