From 65c6bb5c1deac2163c9e2a75287de5e59c8728a9 Mon Sep 17 00:00:00 2001 From: kiramt Date: Tue, 30 Jan 2018 15:43:08 +0000 Subject: [PATCH] JAL-2759 updateForDeletedRegion no longer needed --- src/jalview/datamodel/HiddenColumns.java | 2 -- src/jalview/datamodel/HiddenColumnsCursor.java | 26 ------------------- .../jalview/datamodel/HiddenColumnsCursorTest.java | 27 -------------------- 3 files changed, 55 deletions(-) diff --git a/src/jalview/datamodel/HiddenColumns.java b/src/jalview/datamodel/HiddenColumns.java index 0b66b07..c40c105 100644 --- a/src/jalview/datamodel/HiddenColumns.java +++ b/src/jalview/datamodel/HiddenColumns.java @@ -394,8 +394,6 @@ public class HiddenColumns int colsToRemove = region[1] - region[0] + 1; hiddenColumns.remove(regionIndex); numColumns -= colsToRemove; - - cursor.updateForDeletedRegion(hiddenColumns, colsToRemove); } } } diff --git a/src/jalview/datamodel/HiddenColumnsCursor.java b/src/jalview/datamodel/HiddenColumnsCursor.java index 572f999..2e9d798 100644 --- a/src/jalview/datamodel/HiddenColumnsCursor.java +++ b/src/jalview/datamodel/HiddenColumnsCursor.java @@ -72,32 +72,6 @@ public class HiddenColumnsCursor } /** - * Delete the region the cursor is currently at. Avoids having to reset the - * cursor just because we deleted a region. - * - * Calls to updateForDeletedRegion should be made from within a writeLock in - * the HiddenColumns class - since changes to the hiddenColumns collection - * require a writeLock the lock should already exist. - * - * @param hiddenCols - * replacement list of hidden column regions - * @param remove - * number of columns which were deleted - */ - protected void updateForDeletedRegion(List hiddenCols, int remove) - { - hiddenColumns = hiddenCols; - if (!hiddenCols.isEmpty()) - { - if (cursorPos.getRegionIndex() >= hiddenCols.size()) - { - cursorPos = new HiddenCursorPosition(hiddenCols.size(), - cursorPos.getHiddenSoFar() - remove); - } - } - } - - /** * Get the cursor pointing to the hidden region that column is within (if * column is hidden) or which is to the right of column (if column is * visible). If no hidden columns are to the right, returns a cursor pointing diff --git a/test/jalview/datamodel/HiddenColumnsCursorTest.java b/test/jalview/datamodel/HiddenColumnsCursorTest.java index dc627bc..97402b8 100644 --- a/test/jalview/datamodel/HiddenColumnsCursorTest.java +++ b/test/jalview/datamodel/HiddenColumnsCursorTest.java @@ -154,31 +154,4 @@ public class HiddenColumnsCursorTest offset = cursor.findRegionForColumn(80, true).getHiddenSoFar(); assertEquals(46, offset); } - - /** - * Test the method which updates for a deleted region - */ - @Test(groups = { "Functional" }) - public void testUpdateForDeletedRegion() - { - List hlist = new ArrayList<>(); - HiddenColumnsCursor cursor = new HiddenColumnsCursor(hlist, 1, 5); - cursor.updateForDeletedRegion(hlist, 0); - assertNull(cursor.findRegionForColumn(30, false)); - - hlist.add(new int[] { 3, 7 }); - hlist.add(new int[] { 15, 25 }); - - cursor = new HiddenColumnsCursor(hlist, 1, 5); - - HiddenCursorPosition p = cursor.findRegionForColumn(30, false); - assertEquals(16, p.getHiddenSoFar()); - - List hlist2 = new ArrayList<>(); - hlist2.add(new int[] { 3, 7 }); - cursor.updateForDeletedRegion(hlist2, 11); - p = cursor.findRegionForColumn(30, false); - assertEquals(5, p.getHiddenSoFar()); - } - } -- 1.7.10.2