From: kiramt Date: Tue, 21 Nov 2017 10:44:47 +0000 (+0000) Subject: JAL-2759 corrected old getVisibleBlocksIterator calls for new call X-Git-Tag: Release_2_10_4~55^2~1^2~58 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d35e6861455e97d57143fd7881fb4a35167a2b9d;p=jalview.git JAL-2759 corrected old getVisibleBlocksIterator calls for new call --- diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index 076b0a3..9d9ee2c 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -566,7 +566,7 @@ public class SeqCanvas extends Panel implements ViewportListenerI HiddenColumns hidden = av.getAlignment().getHiddenColumns(); VisibleContigsIterator regions = (VisibleContigsIterator) hidden - .getVisContigsIterator(startRes, endRes, true); + .getVisContigsIterator(startRes, endRes + 1, true); while (regions.hasNext()) { diff --git a/src/jalview/datamodel/HiddenColumns.java b/src/jalview/datamodel/HiddenColumns.java index 5ac0abb..7862975 100644 --- a/src/jalview/datamodel/HiddenColumns.java +++ b/src/jalview/datamodel/HiddenColumns.java @@ -31,17 +31,16 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; * 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. * @@ -82,7 +81,8 @@ public class HiddenColumns * 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). */ /** diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 5c5fbbe..2a43e85 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -1031,7 +1031,7 @@ public class SeqCanvas extends JComponent implements ViewportListenerI HiddenColumns hidden = av.getAlignment().getHiddenColumns(); VisibleContigsIterator regions = (VisibleContigsIterator) hidden - .getVisContigsIterator(startRes, endRes, true); + .getVisContigsIterator(startRes, endRes + 1, true); while (regions.hasNext()) { @@ -1365,7 +1365,7 @@ public class SeqCanvas extends JComponent implements ViewportListenerI 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(); diff --git a/test/jalview/datamodel/HiddenColumnsTest.java b/test/jalview/datamodel/HiddenColumnsTest.java index e66367b..7b0e8af 100644 --- a/test/jalview/datamodel/HiddenColumnsTest.java +++ b/test/jalview/datamodel/HiddenColumnsTest.java @@ -1322,7 +1322,7 @@ public class HiddenColumnsTest public void testVisibleBlocksVisBoundsIterator() { HiddenColumns h = new HiddenColumns(); - Iterator regions = h.getVisContigsIterator(0, 30, true); + Iterator regions = h.getVisContigsIterator(0, 31, true); // only 1 visible region spanning 0-30 if nothing is hidden assertTrue(regions.hasNext()); @@ -1335,7 +1335,7 @@ public class HiddenColumnsTest // 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(); @@ -1349,7 +1349,7 @@ public class HiddenColumnsTest // 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(); @@ -1360,7 +1360,7 @@ public class HiddenColumnsTest // 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(); @@ -1375,7 +1375,7 @@ public class HiddenColumnsTest 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(); @@ -1390,7 +1390,7 @@ public class HiddenColumnsTest 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(); @@ -1408,7 +1408,7 @@ public class HiddenColumnsTest 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(); @@ -1426,7 +1426,7 @@ public class HiddenColumnsTest 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();