From 3ca62ac09227ae36e2197050e8910382ea30f3fe Mon Sep 17 00:00:00 2001 From: hansonr Date: Mon, 4 Feb 2019 08:48:05 -0600 Subject: [PATCH] fixing array processing order - does point out an issue with hiddenColumns joining adjacent hides sometimes but not other times. --- src/jalview/io/JSONFile.java | 4 ++-- test/jalview/io/JSONFileTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/jalview/io/JSONFile.java b/src/jalview/io/JSONFile.java index 427ad8f..e0f28bb 100644 --- a/src/jalview/io/JSONFile.java +++ b/src/jalview/io/JSONFile.java @@ -601,7 +601,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile if (hiddenSeqs != null && !hiddenSeqs.isEmpty()) { String[] seqRefs = hiddenSeqs.split(";"); - for (int i = seqRefs.length; --i >= 0;) + for (int i = 0, n = seqRefs.length; i < n; i++) { hiddenSeqRefs.add(seqRefs[i]); } @@ -615,7 +615,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile { hiddenColumns = new HiddenColumns(); String[] rangeStrings = hiddenCols.split(";"); - for (int i = rangeStrings.length; --i >= 0;) + for (int i = 0, n = rangeStrings.length; i < n; i++) { String[] range = rangeStrings[i].split("-"); hiddenColumns.hideColumns(Integer.valueOf(range[0]), diff --git a/test/jalview/io/JSONFileTest.java b/test/jalview/io/JSONFileTest.java index 560a6a8..2d5f7a2 100644 --- a/test/jalview/io/JSONFileTest.java +++ b/test/jalview/io/JSONFileTest.java @@ -236,7 +236,7 @@ public class JSONFileTest testAlignment = formatAdapter.readFile(jsonOutput, DataSourceType.PASTE, FileFormat.Json); testJsonFile = (JSONFile) formatAdapter.getAlignFile(); - // System.out.println(jsonOutput); + System.out.println(jsonOutput); } catch (IOException e) { e.printStackTrace(); -- 1.7.10.2