From 290417727ff37c2d08bbe8962c6a6cd6a187cfe0 Mon Sep 17 00:00:00 2001 From: kiramt Date: Wed, 20 Sep 2017 16:25:06 +0100 Subject: [PATCH] JAL-2674 fix up interface of locateVisibleBoundsOfSequence --- src/jalview/datamodel/HiddenColumns.java | 7 +-- src/jalview/renderer/ScaleRenderer.java | 6 +- test/jalview/datamodel/HiddenColumnsTest.java | 79 ------------------------- 3 files changed, 6 insertions(+), 86 deletions(-) diff --git a/src/jalview/datamodel/HiddenColumns.java b/src/jalview/datamodel/HiddenColumns.java index c0a43ee..305a6f1 100644 --- a/src/jalview/datamodel/HiddenColumns.java +++ b/src/jalview/datamodel/HiddenColumns.java @@ -923,7 +923,7 @@ public class HiddenColumns { int ifpos = seq.findIndex(fpos) - 1; int ilpos = seq.findIndex(lpos) - 1; - return new int[] { ifpos, ilpos, fpos, lpos, ifpos, ilpos }; + return new int[] { ifpos, ifpos, ilpos }; } // Simply walk along the sequence whilst watching for hidden column @@ -982,11 +982,10 @@ public class HiddenColumns } if (foundStart) { - return new int[] { findColumnPosition(start), - findColumnPosition(lastvispos), fpos, lpos, firstP, lastP }; + return new int[] { findColumnPosition(start), firstP, lastP }; } // otherwise, sequence was completely hidden - return new int[] { visPrev, visNext, 0, 0, firstP, lastP }; + return new int[] { visPrev, firstP, lastP }; } finally { LOCK.readLock().unlock(); diff --git a/src/jalview/renderer/ScaleRenderer.java b/src/jalview/renderer/ScaleRenderer.java index 9fec256..d310705 100644 --- a/src/jalview/renderer/ScaleRenderer.java +++ b/src/jalview/renderer/ScaleRenderer.java @@ -77,8 +77,8 @@ public class ScaleRenderer .locateVisibleBoundsOfSequence(refSeq); refSp = refbounds[0]; - refStartI = refbounds[4]; - refEndI = refbounds[5]; + refStartI = refbounds[1]; + refEndI = refbounds[2]; scalestartx = refSp + ((scalestartx - refSp) / 10) * 10; } @@ -86,7 +86,7 @@ public class ScaleRenderer { scalestartx += 5; } - List marks = new ArrayList(); + List marks = new ArrayList<>(); String string; int refN, iadj; // todo: add a 'reference origin column' to set column number relative to diff --git a/test/jalview/datamodel/HiddenColumnsTest.java b/test/jalview/datamodel/HiddenColumnsTest.java index 1aec1d3..6b4e05d 100644 --- a/test/jalview/datamodel/HiddenColumnsTest.java +++ b/test/jalview/datamodel/HiddenColumnsTest.java @@ -1055,85 +1055,6 @@ public class HiddenColumnsTest assertEquals(4, h.adjustForHiddenColumns(2)); } - /*@Test(groups = "Functional") - public void testCompensateForEdit() - { - HiddenColumns2 h = new HiddenColumns2(); - - ColumnSelection sel = new ColumnSelection(); - assertNull(h.compensateForEdit(10, 3, sel)); - - h.hideColumns(3, 4); - List result = h.compensateForEdit(10, 3, sel); - assertEquals(0, result.size()); - - // edit partially overlapping hidden - - h = new HiddenColumns2(); - h.hideColumns(15, 17); - result = h.compensateForEdit(10, 6, sel); - assertEquals(0, result.size()); - - HiddenColumns2 h2 = new HiddenColumns2(); - h2.hideColumns(9, 11); - assertTrue(h.equals(h2)); - - // edit fully overlapping hidden - - h = new HiddenColumns2(); - h.hideColumns(15, 17); - result = h.compensateForEdit(10, 8, sel); - assertEquals(result.get(0)[0], 15); - assertEquals(result.get(0)[1], 17); - assertFalse(h.hasHiddenColumns()); - - // edit at start - - h = new HiddenColumns2(); - h.hideColumns(0, 3); - result = h.compensateForEdit(0, 4, sel); - assertEquals(0, result.size()); - assertEquals(sel.getSelected().size(), 4); - assertFalse(h.hasHiddenColumns()); - }*/ - - /*@Test(groups = "Functional") - public void testCompensateForDelEdits() - { - HiddenColumns2 h = new HiddenColumns2(); - HiddenColumns2 h2 = new HiddenColumns2(); - - h.compensateForDelEdits(10, 3); - assertFalse(h.hasHiddenColumns()); - - h = new HiddenColumns2(); - h.hideColumns(3, 4); - h.compensateForDelEdits(10, 3); - h2.hideColumns(3, 4); - assertTrue(h.equals(h2)); - - h = new HiddenColumns2(); - h.hideColumns(15, 17); - h.compensateForDelEdits(10, 6); - h2 = new HiddenColumns2(); - h2.hideColumns(9, 11); - assertTrue(h.equals(h2)); - - h = new HiddenColumns2(); - h.hideColumns(15, 17); - h.compensateForDelEdits(10, 8); - h2 = new HiddenColumns2(); - h2.hideColumns(7, 9); - assertTrue(h.equals(h2)); - - h = new HiddenColumns2(); - h.hideColumns(0, 3); - h.compensateForDelEdits(0, 4); - h2 = new HiddenColumns2(); - h2.hideColumns(0, 0); - assertTrue(h.equals(h2)); - }*/ - @Test(groups = "Functional") public void testGetHiddenBoundaryLeft() { -- 1.7.10.2