HiddenColumns hidden = av.getAlignment().getHiddenColumns();
VisibleContigsIterator regions = (VisibleContigsIterator) hidden
- .getVisContigsIterator(startRes, endRes, true);
+ .getVisContigsIterator(startRes, endRes + 1, true);
while (regions.hasNext())
{
* alignment. To iterate over the collection, or over visible columns/regions,
* use an iterator obtained from one of:
*
- * - getBoundedIterator: iterate over the hidden regions, within some bounds
+ * - getBoundedIterator: iterates over the hidden regions, within some bounds,
+ * returning absolute positions
*
- * - getBoundedStartIterator: iterate over the start positions of hidden
- * regions, within some bounds
+ * - getBoundedStartIterator: iterates over the start positions of hidden
+ * regions, within some bounds, returning visible positions
*
- * - getVisContigsIterator: iterate over visible regions in a range, returning
+ * - getVisContigsIterator: iterates over visible regions in a range, returning
* absolute positions
*
- * - getVisibleBlocksIterator
- *
- * - getVisibleColsIterator: iterate over the visible *columns*
+ * - getVisibleColsIterator: iterates over the visible *columns*
*
* For performance reasons, provide bounds where possible.
*
* Methods which change the hiddenColumns collection. These methods should
* use a writeLock to prevent other threads accessing the hiddenColumns
* collection while changes are being made. They should also reset the hidden
- * columns cursor, and either update the hidden columns count, or set it to 0.
+ * columns cursor, and either update the hidden columns count, or set it to 0
+ * (so that it will later be updated when needed).
*/
/**
HiddenColumns hidden = av.getAlignment().getHiddenColumns();
VisibleContigsIterator regions = (VisibleContigsIterator) hidden
- .getVisContigsIterator(startRes, endRes, true);
+ .getVisContigsIterator(startRes, endRes + 1, true);
while (regions.hasNext())
{
HiddenColumns hidden = av.getAlignment().getHiddenColumns();
VisibleContigsIterator regions = (VisibleContigsIterator) hidden
- .getVisContigsIterator(startRes, endRes, true);
+ .getVisContigsIterator(startRes, endRes + 1, true);
while (regions.hasNext())
{
int[] region = regions.next();
public void testVisibleBlocksVisBoundsIterator()
{
HiddenColumns h = new HiddenColumns();
- Iterator<int[]> regions = h.getVisContigsIterator(0, 30, true);
+ Iterator<int[]> regions = h.getVisContigsIterator(0, 31, true);
// only 1 visible region spanning 0-30 if nothing is hidden
assertTrue(regions.hasNext());
// 2 regions one on either side
// second region boundary accounts for hidden columns
h.hideColumns(10, 15);
- regions = h.getVisContigsIterator(0, 30, true);
+ regions = h.getVisContigsIterator(0, 31, true);
assertTrue(regions.hasNext());
region = regions.next();
// single hidden region at left
h = new HiddenColumns();
h.hideColumns(0, 5);
- regions = h.getVisContigsIterator(0, 30, true);
+ regions = h.getVisContigsIterator(0, 31, true);
assertTrue(regions.hasNext());
region = regions.next();
// single hidden region at right
h = new HiddenColumns();
h.hideColumns(27, 30);
- regions = h.getVisContigsIterator(0, 30, true);
+ regions = h.getVisContigsIterator(0, 31, true);
assertTrue(regions.hasNext());
region = regions.next();
h = new HiddenColumns();
h.hideColumns(0, 5);
h.hideColumns(23, 25);
- regions = h.getVisContigsIterator(0, 30, true);
+ regions = h.getVisContigsIterator(0, 31, true);
assertTrue(regions.hasNext());
region = regions.next();
h = new HiddenColumns();
h.hideColumns(27, 30);
h.hideColumns(11, 14);
- regions = h.getVisContigsIterator(0, 30, true);
+ regions = h.getVisContigsIterator(0, 31, true);
assertTrue(regions.hasNext());
region = regions.next();
h = new HiddenColumns();
h.hideColumns(27, 35);
h.hideColumns(0, 4);
- regions = h.getVisContigsIterator(0, 30, true);
+ regions = h.getVisContigsIterator(0, 31, true);
assertTrue(regions.hasNext());
region = regions.next();
h.hideColumns(9, 11);
h.hideColumns(22, 26);
- regions = h.getVisContigsIterator(0, 30, true);
+ regions = h.getVisContigsIterator(0, 31, true);
assertTrue(regions.hasNext());
region = regions.next();