JAL-2674 HiddenColumns interface tidies
authorkiramt <k.mourao@dundee.ac.uk>
Tue, 26 Sep 2017 10:36:29 +0000 (11:36 +0100)
committerkiramt <k.mourao@dundee.ac.uk>
Tue, 26 Sep 2017 10:36:29 +0000 (11:36 +0100)
src/jalview/datamodel/HiddenColumns.java
src/jalview/gui/Jalview2XML.java
test/jalview/io/JSONFileTest.java

index 9f3b929..88af9fa 100644 (file)
@@ -1448,6 +1448,18 @@ public class HiddenColumns
     }
   }
 
+  public Iterator<int[]> iterator()
+  {
+    if (hiddenColumns != null)
+    {
+      return new BoundedHiddenColsIterator(0, hiddenColumns.size(), true);
+    }
+    else
+    {
+      return new BoundedHiddenColsIterator(0, 0, true);
+    }
+  }
+
   public Iterator<int[]> getBoundedIterator(int start, int end,
           boolean useCopy)
   {
index 1658f0f..921c329 100644 (file)
@@ -1417,9 +1417,10 @@ public class Jalview2XML
         }
         else
         {
-          ArrayList<int[]> hiddenRegions = hidden.getHiddenColumnsCopy();
-          for (int[] region : hiddenRegions)
+          Iterator<int[]> hiddenRegions = hidden.iterator();
+          while (hiddenRegions.hasNext())
           {
+            int[] region = hiddenRegions.next();
             HiddenColumns hc = new HiddenColumns();
             hc.setStart(region[0]);
             hc.setEnd(region[1]);
index 158c901..bfb714d 100644 (file)
@@ -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()
     {