From: hansonr Date: Mon, 4 Feb 2019 14:48:05 +0000 (-0600) Subject: fixing array processing order X-Git-Tag: Release_2_11_4_0~45^2~18^2~256 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3ca62ac09227ae36e2197050e8910382ea30f3fe;p=jalview.git fixing array processing order - does point out an issue with hiddenColumns joining adjacent hides sometimes but not other times. --- 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();