From 607a4aecda2f99866bb1acf7d364a6dde4e215bd Mon Sep 17 00:00:00 2001 From: kiramt Date: Thu, 8 Jun 2017 10:55:52 +0100 Subject: [PATCH] JAL-2591 More HiddenColumns refactoring. Tests passing. --- src/jalview/appletgui/SeqCanvas.java | 2 +- src/jalview/datamodel/CigarArray.java | 2 +- src/jalview/datamodel/HiddenColumns.java | 13 ++++- src/jalview/datamodel/VisibleColsIterator.java | 2 +- src/jalview/gui/SeqCanvas.java | 3 +- src/jalview/util/MappingUtils.java | 3 +- test/jalview/datamodel/ColumnSelectionTest.java | 10 ++-- test/jalview/datamodel/HiddenColumnsTest.java | 70 ++++++++++++++--------- test/jalview/gui/AlignFrameTest.java | 8 +-- test/jalview/io/JSONFileTest.java | 16 +++--- test/jalview/util/MappingUtilsTest.java | 20 +++---- 11 files changed, 85 insertions(+), 64 deletions(-) diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index 94f1caa..d4bf49a 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -570,7 +570,7 @@ public class SeqCanvas extends Panel implements ViewportListenerI if (av.hasHiddenColumns()) { HiddenColumns hidden = av.getAlignment().getHiddenColumns(); - for (int[] region : hidden) + for (int[] region : hidden.getHiddenColumnsCopyAsList()) { int hideStart = region[0]; int hideEnd = region[1]; diff --git a/src/jalview/datamodel/CigarArray.java b/src/jalview/datamodel/CigarArray.java index 837a10b..31af5f8 100644 --- a/src/jalview/datamodel/CigarArray.java +++ b/src/jalview/datamodel/CigarArray.java @@ -90,7 +90,7 @@ public class CigarArray extends CigarBase { this(constructSeqCigarArray(alignment, selectionGroup)); constructFromAlignment(alignment, - hidden != null ? hidden.getHiddenRegions() + hidden != null ? hidden.getHiddenColumnsCopyAsList() : null, selectionGroup); } diff --git a/src/jalview/datamodel/HiddenColumns.java b/src/jalview/datamodel/HiddenColumns.java index 5966312..b53fc8b 100644 --- a/src/jalview/datamodel/HiddenColumns.java +++ b/src/jalview/datamodel/HiddenColumns.java @@ -45,7 +45,7 @@ public class HiddenColumns * * @return empty list or List of hidden column intervals */ - public List getHiddenRegions() + private List getHiddenRegions() { return hiddenColumns == null ? Collections. emptyList() : hiddenColumns; @@ -660,8 +660,14 @@ public class HiddenColumns private ArrayList copyHiddenRegionsToArrayList() { - ArrayList copy = new ArrayList<>(hiddenColumns.size()); - for (int i = 0, j = hiddenColumns.size(); i < j; i++) + int size = 0; + if (hiddenColumns != null) + { + size = hiddenColumns.size(); + } + ArrayList copy = new ArrayList<>(size); + + for (int i = 0, j = size; i < j; i++) { int[] rh; int[] cp; @@ -673,6 +679,7 @@ public class HiddenColumns copy.add(cp); } } + return copy; } diff --git a/src/jalview/datamodel/VisibleColsIterator.java b/src/jalview/datamodel/VisibleColsIterator.java index 70de1e3..5c78f96 100644 --- a/src/jalview/datamodel/VisibleColsIterator.java +++ b/src/jalview/datamodel/VisibleColsIterator.java @@ -48,7 +48,7 @@ public class VisibleColsIterator implements Iterator last = lastcol; current = firstcol; next = firstcol; - hidden = hiddenCols.getHiddenRegions(); + hidden = hiddenCols.getHiddenColumnsCopyAsList(); lasthiddenregion = -1; if (hidden != null) diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 4114385..c46e752 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -667,7 +667,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI int blockStart = startRes; int blockEnd = endRes; - for (int[] region : av.getAlignment().getHiddenColumns()) + for (int[] region : av.getAlignment().getHiddenColumns() + .getHiddenColumnsCopyAsList()) { int hideStart = region[0]; int hideEnd = region[1]; diff --git a/src/jalview/util/MappingUtils.java b/src/jalview/util/MappingUtils.java index f75286a..1fe55f3 100644 --- a/src/jalview/util/MappingUtils.java +++ b/src/jalview/util/MappingUtils.java @@ -518,7 +518,6 @@ public final class MappingUtils AlignViewportI protein = targetIsNucleotide ? mapFrom : mapTo; List codonFrames = protein.getAlignment() .getCodonFrames(); - // ColumnSelection mappedColumns = new ColumnSelection(); if (colsel == null) { @@ -540,7 +539,7 @@ public final class MappingUtils toSequences, fromGapChar); } - for (int[] hidden : hiddencols) + for (int[] hidden : hiddencols.getHiddenColumnsCopyAsList()) { mapHiddenColumns(hidden, codonFrames, newHidden, fromSequences, toSequences, fromGapChar); diff --git a/test/jalview/datamodel/ColumnSelectionTest.java b/test/jalview/datamodel/ColumnSelectionTest.java index 7237e63..b47285c 100644 --- a/test/jalview/datamodel/ColumnSelectionTest.java +++ b/test/jalview/datamodel/ColumnSelectionTest.java @@ -132,7 +132,7 @@ public class ColumnSelectionTest // hide column 5 (and adjacent): cs.hideSelectedColumns(5, al.getHiddenColumns()); // 4,5,6 now hidden: - List hidden = al.getHiddenColumns().getHiddenRegions(); + List hidden = al.getHiddenColumns().getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[4, 6]", Arrays.toString(hidden.get(0))); // none now selected: @@ -145,7 +145,7 @@ public class ColumnSelectionTest cs.addElement(5); cs.addElement(6); cs.hideSelectedColumns(4, al.getHiddenColumns()); - hidden = al.getHiddenColumns().getHiddenRegions(); + hidden = al.getHiddenColumns().getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[4, 6]", Arrays.toString(hidden.get(0))); assertTrue(cs.getSelected().isEmpty()); @@ -157,7 +157,7 @@ public class ColumnSelectionTest cs.addElement(5); cs.addElement(6); cs.hideSelectedColumns(6, al.getHiddenColumns()); - hidden = al.getHiddenColumns().getHiddenRegions(); + hidden = al.getHiddenColumns().getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[4, 6]", Arrays.toString(hidden.get(0))); assertTrue(cs.getSelected().isEmpty()); @@ -168,7 +168,7 @@ public class ColumnSelectionTest cs.addElement(4); cs.addElement(6); cs.hideSelectedColumns(5, al.getHiddenColumns()); - hidden = al.getHiddenColumns().getHiddenRegions(); + hidden = al.getHiddenColumns().getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[4, 6]", Arrays.toString(hidden.get(0))); assertTrue(cs.getSelected().isEmpty()); @@ -196,7 +196,7 @@ public class ColumnSelectionTest cs.hideSelectedColumns(al); assertTrue(cs.getSelected().isEmpty()); - List hidden = cols.getHiddenRegions(); + List hidden = cols.getHiddenColumnsCopyAsList(); assertEquals(4, hidden.size()); assertEquals("[2, 4]", Arrays.toString(hidden.get(0))); assertEquals("[7, 9]", Arrays.toString(hidden.get(1))); diff --git a/test/jalview/datamodel/HiddenColumnsTest.java b/test/jalview/datamodel/HiddenColumnsTest.java index 62c2d22..13cb526 100644 --- a/test/jalview/datamodel/HiddenColumnsTest.java +++ b/test/jalview/datamodel/HiddenColumnsTest.java @@ -23,7 +23,6 @@ package jalview.datamodel; import static org.testng.Assert.assertNull; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; -import static org.testng.AssertJUnit.assertSame; import static org.testng.AssertJUnit.assertTrue; import jalview.analysis.AlignmentGenerator; @@ -233,14 +232,17 @@ public class HiddenColumnsTest HiddenColumns cs = new HiddenColumns(); cs.hideColumns(10, 11); cs.hideColumns(5, 7); - assertEquals("[5, 7]", Arrays.toString(cs.getHiddenRegions().get(0))); + assertEquals("[5, 7]", + Arrays.toString(cs.getHiddenColumnsCopyAsList().get(0))); HiddenColumns cs2 = new HiddenColumns(cs); assertTrue(cs2.hasHiddenColumns()); - assertEquals(2, cs2.getHiddenRegions().size()); + assertEquals(2, cs2.getHiddenColumnsCopyAsList().size()); // hidden columns are held in column order - assertEquals("[5, 7]", Arrays.toString(cs2.getHiddenRegions().get(0))); - assertEquals("[10, 11]", Arrays.toString(cs2.getHiddenRegions().get(1))); + assertEquals("[5, 7]", + Arrays.toString(cs2.getHiddenColumnsCopyAsList().get(0))); + assertEquals("[10, 11]", + Arrays.toString(cs2.getHiddenColumnsCopyAsList().get(1))); } /** @@ -337,66 +339,78 @@ public class HiddenColumnsTest ColumnSelection colsel = new ColumnSelection(); HiddenColumns cs = al.getHiddenColumns(); colsel.hideSelectedColumns(5, al.getHiddenColumns()); - List hidden = cs.getHiddenRegions(); + List hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[5, 5]", Arrays.toString(hidden.get(0))); colsel.hideSelectedColumns(3, al.getHiddenColumns()); + hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(2, hidden.size()); // two hidden ranges, in order: - assertSame(hidden, cs.getHiddenRegions()); + assertEquals(hidden.size(), cs.getHiddenColumnsCopyAsList().size()); assertEquals("[3, 3]", Arrays.toString(hidden.get(0))); assertEquals("[5, 5]", Arrays.toString(hidden.get(1))); // hiding column 4 expands [3, 3] to [3, 4] // and merges to [5, 5] to make [3, 5] colsel.hideSelectedColumns(4, al.getHiddenColumns()); - hidden = cs.getHiddenRegions(); + hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[3, 5]", Arrays.toString(hidden.get(0))); // clear hidden columns (note they are added to selected) cs.revealAllHiddenColumns(colsel); // it is now actually null but getter returns an empty list - assertTrue(cs.getHiddenRegions().isEmpty()); + assertTrue(cs.getHiddenColumnsCopyAsList().isEmpty()); cs.hideColumns(3, 6); - hidden = cs.getHiddenRegions(); + hidden = cs.getHiddenColumnsCopyAsList(); int[] firstHiddenRange = hidden.get(0); assertEquals("[3, 6]", Arrays.toString(firstHiddenRange)); // adding a subrange of already hidden should do nothing cs.hideColumns(4, 5); + hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); - assertSame(firstHiddenRange, cs.getHiddenRegions().get(0)); + assertEquals("[3, 6]", + Arrays.toString(cs.getHiddenColumnsCopyAsList().get(0))); cs.hideColumns(3, 5); + hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); - assertSame(firstHiddenRange, cs.getHiddenRegions().get(0)); + assertEquals("[3, 6]", + Arrays.toString(cs.getHiddenColumnsCopyAsList().get(0))); cs.hideColumns(4, 6); + hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); - assertSame(firstHiddenRange, cs.getHiddenRegions().get(0)); + assertEquals("[3, 6]", + Arrays.toString(cs.getHiddenColumnsCopyAsList().get(0))); cs.hideColumns(3, 6); + hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); - assertSame(firstHiddenRange, cs.getHiddenRegions().get(0)); + assertEquals("[3, 6]", + Arrays.toString(cs.getHiddenColumnsCopyAsList().get(0))); cs.revealAllHiddenColumns(colsel); cs.hideColumns(2, 4); - hidden = cs.getHiddenRegions(); + hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[2, 4]", Arrays.toString(hidden.get(0))); // extend contiguous with 2 positions overlap cs.hideColumns(3, 5); + hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[2, 5]", Arrays.toString(hidden.get(0))); // extend contiguous with 1 position overlap cs.hideColumns(5, 6); + hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[2, 6]", Arrays.toString(hidden.get(0))); // extend contiguous with overlap both ends: cs.hideColumns(1, 7); + hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[1, 7]", Arrays.toString(hidden.get(0))); } @@ -414,7 +428,7 @@ public class HiddenColumnsTest colsel.addElement(10); cs.revealHiddenColumns(5, colsel); // hidden columns list now null but getter returns empty list: - assertTrue(cs.getHiddenRegions().isEmpty()); + assertTrue(cs.getHiddenColumnsCopyAsList().isEmpty()); // revealed columns are marked as selected (added to selection): assertEquals("[10, 5, 6, 7, 8]", colsel.getSelected().toString()); @@ -422,9 +436,9 @@ public class HiddenColumnsTest colsel = new ColumnSelection(); cs = new HiddenColumns(); cs.hideColumns(5, 8); - List hidden = cs.getHiddenRegions(); + List hidden = cs.getHiddenColumnsCopyAsList(); cs.revealHiddenColumns(6, colsel); - assertSame(hidden, cs.getHiddenRegions()); + assertEquals(hidden.size(), cs.getHiddenColumnsCopyAsList().size()); assertTrue(colsel.getSelected().isEmpty()); } @@ -443,7 +457,7 @@ public class HiddenColumnsTest * revealing hidden columns adds them (in order) to the (unordered) * selection list */ - assertTrue(cs.getHiddenRegions().isEmpty()); + assertTrue(cs.getHiddenColumnsCopyAsList().isEmpty()); assertEquals("[11, 1, 2, 3, 5, 6, 7, 8]", colsel.getSelected() .toString()); } @@ -479,13 +493,13 @@ public class HiddenColumnsTest HiddenColumns cs = new HiddenColumns(); cs.hideColumns(49, 59); cs.hideColumns(69, 79); - List hidden = cs.getHiddenRegions(); + List hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(2, hidden.size()); assertEquals("[49, 59]", Arrays.toString(hidden.get(0))); assertEquals("[69, 79]", Arrays.toString(hidden.get(1))); cs.hideColumns(48, 80); - hidden = cs.getHiddenRegions(); + hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[48, 80]", Arrays.toString(hidden.get(0))); @@ -498,7 +512,7 @@ public class HiddenColumnsTest cs.hideColumns(50, 60); // hiding 21-49 should merge to one range cs.hideColumns(21, 49); - hidden = cs.getHiddenRegions(); + hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[10, 60]", Arrays.toString(hidden.get(0))); @@ -514,7 +528,7 @@ public class HiddenColumnsTest cs.hideColumns(60, 70); cs.hideColumns(15, 45); - hidden = cs.getHiddenRegions(); + hidden = cs.getHiddenColumnsCopyAsList(); assertEquals(2, hidden.size()); assertEquals("[10, 50]", Arrays.toString(hidden.get(0))); assertEquals("[60, 70]", Arrays.toString(hidden.get(1))); @@ -531,23 +545,23 @@ public class HiddenColumnsTest one.set(1); cs = new HiddenColumns(); cs.hideMarkedBits(one); - assertEquals(1, cs.getHiddenRegions().size()); + assertEquals(1, cs.getHiddenColumnsCopyAsList().size()); one.set(2); cs = new HiddenColumns(); cs.hideMarkedBits(one); - assertEquals(1, cs.getHiddenRegions().size()); + assertEquals(1, cs.getHiddenColumnsCopyAsList().size()); one.set(3); cs = new HiddenColumns(); cs.hideMarkedBits(one); - assertEquals(1, cs.getHiddenRegions().size()); + assertEquals(1, cs.getHiddenColumnsCopyAsList().size()); // split one.clear(2); cs = new HiddenColumns(); cs.hideMarkedBits(one); - assertEquals(2, cs.getHiddenRegions().size()); + assertEquals(2, cs.getHiddenColumnsCopyAsList().size()); assertEquals(0, cs.adjustForHiddenColumns(0)); assertEquals(2, cs.adjustForHiddenColumns(1)); @@ -558,7 +572,7 @@ public class HiddenColumnsTest cs = new HiddenColumns(); cs.hideMarkedBits(one); - assertEquals(1, cs.getHiddenRegions().size()); + assertEquals(1, cs.getHiddenColumnsCopyAsList().size()); assertEquals(0, cs.adjustForHiddenColumns(0)); assertEquals(1, cs.adjustForHiddenColumns(1)); diff --git a/test/jalview/gui/AlignFrameTest.java b/test/jalview/gui/AlignFrameTest.java index fed5992..721ffc8 100644 --- a/test/jalview/gui/AlignFrameTest.java +++ b/test/jalview/gui/AlignFrameTest.java @@ -86,12 +86,12 @@ public class AlignFrameTest assertFalse(alignFrame.hideFeatureColumns("exon", true)); assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty()); assertTrue(alignFrame.getViewport().getAlignment().getHiddenColumns() - .getHiddenRegions() + .getHiddenColumnsCopyAsList() .isEmpty()); assertFalse(alignFrame.hideFeatureColumns("exon", false)); assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty()); assertTrue(alignFrame.getViewport().getAlignment().getHiddenColumns() - .getHiddenRegions() + .getHiddenColumnsCopyAsList() .isEmpty()); /* @@ -101,7 +101,7 @@ public class AlignFrameTest assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty()); List hidden = alignFrame.getViewport().getAlignment() .getHiddenColumns() - .getHiddenRegions(); + .getHiddenColumnsCopyAsList(); assertTrue(hidden.isEmpty()); /* @@ -111,7 +111,7 @@ public class AlignFrameTest */ assertTrue(alignFrame.hideFeatureColumns("Turn", true)); hidden = alignFrame.getViewport().getAlignment().getHiddenColumns() - .getHiddenRegions(); + .getHiddenColumnsCopyAsList(); assertEquals(hidden.size(), 2); assertEquals(hidden.get(0)[0], 1); assertEquals(hidden.get(0)[1], 3); diff --git a/test/jalview/io/JSONFileTest.java b/test/jalview/io/JSONFileTest.java index 2aff5cc..6da6f5f 100644 --- a/test/jalview/io/JSONFileTest.java +++ b/test/jalview/io/JSONFileTest.java @@ -73,11 +73,11 @@ public class JSONFileTest private Alignment alignment; - private HashMap expectedSeqs = new HashMap(); + private HashMap expectedSeqs = new HashMap<>(); - private HashMap expectedAnnots = new HashMap(); + private HashMap expectedAnnots = new HashMap<>(); - private HashMap expectedGrps = new HashMap(); + private HashMap expectedGrps = new HashMap<>(); private HiddenColumns expectedColSel = new HiddenColumns(); @@ -131,7 +131,7 @@ public class JSONFileTest } // create and add a sequence group - List grpSeqs = new ArrayList(); + List grpSeqs = new ArrayList<>(); grpSeqs.add(seqs[1]); grpSeqs.add(seqs[2]); grpSeqs.add(seqs[3]); @@ -195,7 +195,7 @@ public class JSONFileTest TEST_SEQ_HEIGHT = expectedSeqs.size(); TEST_GRP_HEIGHT = expectedGrps.size(); TEST_ANOT_HEIGHT = expectedAnnots.size(); - TEST_CS_HEIGHT = expectedColSel.getHiddenRegions().size(); + TEST_CS_HEIGHT = expectedColSel.getHiddenColumnsCopyAsList().size(); exportSettings = new AlignExportSettingI() { @@ -315,11 +315,11 @@ public class JSONFileTest { HiddenColumns cs = testJsonFile.getHiddenColumns(); Assert.assertNotNull(cs); - Assert.assertNotNull(cs.getHiddenRegions()); - List hiddenCols = cs.getHiddenRegions(); + Assert.assertNotNull(cs.getHiddenColumnsCopyAsList()); + List hiddenCols = cs.getHiddenColumnsCopyAsList(); Assert.assertEquals(hiddenCols.size(), TEST_CS_HEIGHT); Assert.assertEquals(hiddenCols.get(0), expectedColSel - .getHiddenRegions().get(0), + .getHiddenColumnsCopyAsList().get(0), "Mismatched hidden columns!"); } diff --git a/test/jalview/util/MappingUtilsTest.java b/test/jalview/util/MappingUtilsTest.java index 19c8438..c8b6034 100644 --- a/test/jalview/util/MappingUtilsTest.java +++ b/test/jalview/util/MappingUtilsTest.java @@ -689,7 +689,7 @@ public class MappingUtilsTest AlignedCodonFrame acf3 = new AlignedCodonFrame(); acf3.addMap(seq3.getDatasetSequence(), seq1.getDatasetSequence(), map); - List mappings = new ArrayList(); + List mappings = new ArrayList<>(); mappings.add(acf1); mappings.add(acf2); mappings.add(acf3); @@ -764,7 +764,7 @@ public class MappingUtilsTest AlignedCodonFrame acf4 = new AlignedCodonFrame(); acf4.addMap(seq3.getDatasetSequence(), seq4.getDatasetSequence(), map); - List mappings = new ArrayList(); + List mappings = new ArrayList<>(); mappings.add(acf1); mappings.add(acf2); mappings.add(acf3); @@ -821,7 +821,7 @@ public class MappingUtilsTest AlignedCodonFrame acf = new AlignedCodonFrame(); MapList map = new MapList(new int[] { 8, 16 }, new int[] { 5, 7 }, 3, 1); acf.addMap(dna.getDatasetSequence(), protein.getDatasetSequence(), map); - List mappings = new ArrayList(); + List mappings = new ArrayList<>(); mappings.add(acf); AlignmentI prot = new Alignment(new SequenceI[] { protein }); @@ -913,7 +913,7 @@ public class MappingUtilsTest MappingUtils.mapColumnSelection(proteinSelection, hiddenCols, proteinView, dnaView, dnaSelection, dnaHidden); assertEquals("[]", dnaSelection.getSelected().toString()); - List hidden = dnaHidden.getHiddenRegions(); + List hidden = dnaHidden.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[0, 4]", Arrays.toString(hidden.get(0))); @@ -930,7 +930,7 @@ public class MappingUtilsTest proteinSelection.hideSelectedColumns(1, hiddenCols); MappingUtils.mapColumnSelection(proteinSelection, hiddenCols, proteinView, dnaView, dnaSelection, dnaHidden); - hidden = dnaHidden.getHiddenRegions(); + hidden = dnaHidden.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[0, 3]", Arrays.toString(hidden.get(0))); @@ -944,7 +944,7 @@ public class MappingUtilsTest proteinSelection.hideSelectedColumns(2, hiddenCols); MappingUtils.mapColumnSelection(proteinSelection, hiddenCols, proteinView, dnaView, dnaSelection, dnaHidden); - assertTrue(dnaHidden.getHiddenRegions().isEmpty()); + assertTrue(dnaHidden.getHiddenColumnsCopyAsList().isEmpty()); /* * Column 3 in protein picks up Seq1/P, Seq2/Q, Seq3/S which map to columns @@ -959,7 +959,7 @@ public class MappingUtilsTest MappingUtils.mapColumnSelection(proteinSelection, hiddenCols, proteinView, dnaView, dnaSelection, dnaHidden); assertEquals("[0, 1, 2, 3]", dnaSelection.getSelected().toString()); - hidden = dnaHidden.getHiddenRegions(); + hidden = dnaHidden.getHiddenColumnsCopyAsList(); assertEquals(1, hidden.size()); assertEquals("[5, 10]", Arrays.toString(hidden.get(0))); @@ -974,7 +974,7 @@ public class MappingUtilsTest proteinSelection.hideSelectedColumns(3, hiddenCols); MappingUtils.mapColumnSelection(proteinSelection, hiddenCols, proteinView, dnaView, dnaSelection, dnaHidden); - hidden = dnaHidden.getHiddenRegions(); + hidden = dnaHidden.getHiddenColumnsCopyAsList(); assertEquals(2, hidden.size()); assertEquals("[0, 3]", Arrays.toString(hidden.get(0))); assertEquals("[5, 10]", Arrays.toString(hidden.get(1))); @@ -988,7 +988,7 @@ public class MappingUtilsTest /* * [start, end] ranges */ - List ranges = new ArrayList(); + List ranges = new ArrayList<>(); assertEquals(0, MappingUtils.getLength(ranges)); ranges.add(new int[] { 1, 1 }); assertEquals(1, MappingUtils.getLength(ranges)); @@ -1011,7 +1011,7 @@ public class MappingUtilsTest public void testContains() { assertFalse(MappingUtils.contains(null, 1)); - List ranges = new ArrayList(); + List ranges = new ArrayList<>(); assertFalse(MappingUtils.contains(ranges, 1)); ranges.add(new int[] { 1, 4 }); -- 1.7.10.2