From: kiramt Date: Fri, 17 Mar 2017 07:24:00 +0000 (+0000) Subject: JAL-2388 Renamed column and row subtraction functions X-Git-Tag: Release_2_10_2~3^2~92^2~32 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6d183feafe3e566501af586286bbd1d2107ee5a9;p=jalview.git JAL-2388 Renamed column and row subtraction functions --- diff --git a/src/jalview/datamodel/ColumnSelection.java b/src/jalview/datamodel/ColumnSelection.java index 56d9859..97bc5a3 100644 --- a/src/jalview/datamodel/ColumnSelection.java +++ b/src/jalview/datamodel/ColumnSelection.java @@ -744,7 +744,7 @@ public class ColumnSelection * the column to start from * @return the position of the column in the visible alignment */ - public int findColumnNToLeft(int visibleDistance, int startColumn) + public int subtractVisibleColumns(int visibleDistance, int startColumn) { int distance = visibleDistance; diff --git a/src/jalview/datamodel/HiddenSequences.java b/src/jalview/datamodel/HiddenSequences.java index d3aa01a..6950c28 100755 --- a/src/jalview/datamodel/HiddenSequences.java +++ b/src/jalview/datamodel/HiddenSequences.java @@ -294,7 +294,7 @@ public class HiddenSequences * the row to start from * @return the position of the row in the visible alignment */ - public int findIndexNAboveRow(int visibleDistance, int startRow) + public int subtractVisibleRows(int visibleDistance, int startRow) { // walk upwards through the alignment // count all the non-null sequences until we have visibleDistance counted diff --git a/src/jalview/viewmodel/OverviewDimensions.java b/src/jalview/viewmodel/OverviewDimensions.java index 1e9eaf7..43680b5 100644 --- a/src/jalview/viewmodel/OverviewDimensions.java +++ b/src/jalview/viewmodel/OverviewDimensions.java @@ -174,7 +174,7 @@ public class OverviewDimensions if ((scrollCol + vpwidth - 1) < visAlignWidth) { visXAsRes = hiddenCols.findColumnPosition(hiddenCols - .findColumnNToLeft(vpwidth - 1, alwidth - 1)); + .subtractVisibleColumns(vpwidth - 1, alwidth - 1)); } else { @@ -209,7 +209,7 @@ public class OverviewDimensions if ((scrollRow + vpheight - 1) < visAlignHeight) { visYAsRes = hiddenSeqs.findIndexWithoutHiddenSeqs(hiddenSeqs - .findIndexNAboveRow(vpheight - 1, alheight - 1)); + .subtractVisibleRows(vpheight - 1, alheight - 1)); } else { diff --git a/test/jalview/datamodel/ColumnSelectionTest.java b/test/jalview/datamodel/ColumnSelectionTest.java index 49f29d7..4d3f611 100644 --- a/test/jalview/datamodel/ColumnSelectionTest.java +++ b/test/jalview/datamodel/ColumnSelectionTest.java @@ -150,15 +150,15 @@ public class ColumnSelectionTest // test that without hidden columns, findColumnNToLeft returns // position n to left of provided position - int pos = cs.findColumnNToLeft(3, 10); + int pos = cs.subtractVisibleColumns(3, 10); assertEquals(7, pos); // 0 returns same position - pos = cs.findColumnNToLeft(0, 10); + pos = cs.subtractVisibleColumns(0, 10); assertEquals(10, pos); // overflow to left returns negative number - pos = cs.findColumnNToLeft(3, 0); + pos = cs.subtractVisibleColumns(3, 0); assertEquals(-3, pos); // test that with hidden columns to left of result column @@ -166,21 +166,21 @@ public class ColumnSelectionTest cs.hideColumns(1, 3); // position n to left of provided position - pos = cs.findColumnNToLeft(3, 10); + pos = cs.subtractVisibleColumns(3, 10); assertEquals(7, pos); // 0 returns same position - pos = cs.findColumnNToLeft(0, 10); + pos = cs.subtractVisibleColumns(0, 10); assertEquals(10, pos); // test with one set of hidden columns between start and required position cs.hideColumns(12, 15); - pos = cs.findColumnNToLeft(8, 17); + pos = cs.subtractVisibleColumns(8, 17); assertEquals(5, pos); // test with two sets of hidden columns between start and required position cs.hideColumns(20, 21); - pos = cs.findColumnNToLeft(8, 23); + pos = cs.subtractVisibleColumns(8, 23); assertEquals(9, pos); // repeat last 2 tests with no hidden columns to left of required position @@ -188,12 +188,12 @@ public class ColumnSelectionTest // test with one set of hidden columns between start and required position cs.hideColumns(12, 15); - pos = cs.findColumnNToLeft(8, 17); + pos = cs.subtractVisibleColumns(8, 17); assertEquals(5, pos); // test with two sets of hidden columns between start and required position cs.hideColumns(20, 21); - pos = cs.findColumnNToLeft(8, 23); + pos = cs.subtractVisibleColumns(8, 23); assertEquals(9, pos); } diff --git a/test/jalview/datamodel/HiddenSequencesTest.java b/test/jalview/datamodel/HiddenSequencesTest.java index a556458..7795988 100644 --- a/test/jalview/datamodel/HiddenSequencesTest.java +++ b/test/jalview/datamodel/HiddenSequencesTest.java @@ -219,15 +219,15 @@ public class HiddenSequencesTest // test that without hidden rows, findIndexNFromRow returns // position n above provided position - int pos = hs.findIndexNAboveRow(3, 10); + int pos = hs.subtractVisibleRows(3, 10); assertEquals(7, pos); // 0 returns same position - pos = hs.findIndexNAboveRow(0, 10); + pos = hs.subtractVisibleRows(0, 10); assertEquals(10, pos); // overflow to top returns negative number - pos = hs.findIndexNAboveRow(3, 0); + pos = hs.subtractVisibleRows(3, 0); assertEquals(-3, pos); // test that with hidden rows above result row @@ -237,11 +237,11 @@ public class HiddenSequencesTest hs.hideSequence(seqs[3]); // position n above provided position - pos = hs.findIndexNAboveRow(3, 10); + pos = hs.subtractVisibleRows(3, 10); assertEquals(7, pos); // 0 returns same position - pos = hs.findIndexNAboveRow(0, 10); + pos = hs.subtractVisibleRows(0, 10); assertEquals(10, pos); // test with one set of hidden rows between start and required position @@ -249,13 +249,13 @@ public class HiddenSequencesTest hs.hideSequence(seqs[13]); hs.hideSequence(seqs[14]); hs.hideSequence(seqs[15]); - pos = hs.findIndexNAboveRow(8, 17); + pos = hs.subtractVisibleRows(8, 17); assertEquals(5, pos); // test with two sets of hidden rows between start and required position hs.hideSequence(seqs[20]); hs.hideSequence(seqs[21]); - pos = hs.findIndexNAboveRow(8, 23); + pos = hs.subtractVisibleRows(8, 23); assertEquals(9, pos); // repeat last 2 tests with no hidden columns to left of required position @@ -266,13 +266,13 @@ public class HiddenSequencesTest hs.hideSequence(seqs[13]); hs.hideSequence(seqs[14]); hs.hideSequence(seqs[15]); - pos = hs.findIndexNAboveRow(8, 17); + pos = hs.subtractVisibleRows(8, 17); assertEquals(5, pos); // test with two sets of hidden rows between start and required position hs.hideSequence(seqs[20]); hs.hideSequence(seqs[21]); - pos = hs.findIndexNAboveRow(8, 23); + pos = hs.subtractVisibleRows(8, 23); assertEquals(9, pos); }