From c2e16e95b564932deda33dc59ecaea367e7b33b0 Mon Sep 17 00:00:00 2001 From: kiramt Date: Tue, 26 Sep 2017 11:36:29 +0100 Subject: [PATCH] JAL-2674 HiddenColumns interface tidies --- src/jalview/datamodel/HiddenColumns.java | 12 ++++++++++++ src/jalview/gui/Jalview2XML.java | 5 +++-- test/jalview/io/JSONFileTest.java | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/jalview/datamodel/HiddenColumns.java b/src/jalview/datamodel/HiddenColumns.java index 9f3b929..88af9fa 100644 --- a/src/jalview/datamodel/HiddenColumns.java +++ b/src/jalview/datamodel/HiddenColumns.java @@ -1448,6 +1448,18 @@ public class HiddenColumns } } + public Iterator iterator() + { + if (hiddenColumns != null) + { + return new BoundedHiddenColsIterator(0, hiddenColumns.size(), true); + } + else + { + return new BoundedHiddenColsIterator(0, 0, true); + } + } + public Iterator getBoundedIterator(int start, int end, boolean useCopy) { diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 1658f0f88..921c329 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -1417,9 +1417,10 @@ public class Jalview2XML } else { - ArrayList hiddenRegions = hidden.getHiddenColumnsCopy(); - for (int[] region : hiddenRegions) + Iterator hiddenRegions = hidden.iterator(); + while (hiddenRegions.hasNext()) { + int[] region = hiddenRegions.next(); HiddenColumns hc = new HiddenColumns(); hc.setStart(region[0]); hc.setEnd(region[1]); diff --git a/test/jalview/io/JSONFileTest.java b/test/jalview/io/JSONFileTest.java index 158c901..bfb714d 100644 --- a/test/jalview/io/JSONFileTest.java +++ b/test/jalview/io/JSONFileTest.java @@ -205,7 +205,7 @@ public class JSONFileTest TEST_SEQ_HEIGHT = expectedSeqs.size(); TEST_GRP_HEIGHT = expectedGrps.size(); TEST_ANOT_HEIGHT = expectedAnnots.size(); - TEST_CS_HEIGHT = expectedColSel.getHiddenColumnsCopy().size(); + TEST_CS_HEIGHT = expectedColSel.getSize(); exportSettings = new AlignExportSettingI() { -- 1.7.10.2