X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FMapList.java;fp=src%2Fjalview%2Futil%2FMapList.java;h=e456dabdc281946dae004e527487d07569a7d11b;hb=9623cea766a766683243235557ad48e6f7659e6a;hp=662240eea4e86ff19a944392efa99d4fd5abd4a6;hpb=6066400ed6b0fe288ebbea82389f59838a534706;p=jalview.git diff --git a/src/jalview/util/MapList.java b/src/jalview/util/MapList.java index 662240e..e456dab 100644 --- a/src/jalview/util/MapList.java +++ b/src/jalview/util/MapList.java @@ -202,8 +202,7 @@ public class MapList fromLowest = Math.min(fromLowest, from[i]); fromHighest = Math.max(fromHighest, from[i + 1]); - fromShifts.add(new int[] - { from[i], from[i + 1] }); + fromShifts.add(new int[] { from[i], from[i + 1] }); } toLowest = to[0]; @@ -212,8 +211,7 @@ public class MapList { toLowest = Math.min(toLowest, to[i]); toHighest = Math.max(toHighest, to[i + 1]); - toShifts.add(new int[] - { to[i], to[i + 1] }); + toShifts.add(new int[] { to[i], to[i + 1] }); } } @@ -236,16 +234,14 @@ public class MapList { for (int[] r : map.fromShifts) { - fromShifts.add(new int[] - { r[0], r[1] }); + fromShifts.add(new int[] { r[0], r[1] }); } } if (map.toShifts != null) { for (int[] r : map.toShifts) { - toShifts.add(new int[] - { r[0], r[1] }); + toShifts.add(new int[] { r[0], r[1] }); } } } @@ -258,8 +254,8 @@ public class MapList * @param fromRatio * @param toRatio */ - public MapList(List fromRange, List toRange, - int fromRatio, int toRatio) + public MapList(List fromRange, List toRange, int fromRatio, + int toRatio) { this.fromShifts = fromRange; this.toShifts = toRange; @@ -268,7 +264,8 @@ public class MapList fromLowest = Integer.MAX_VALUE; fromHighest = 0; - for (int[] range : fromRange) { + for (int[] range : fromRange) + { fromLowest = Math.min(fromLowest, range[0]); fromHighest = Math.max(fromHighest, range[1]); } @@ -313,8 +310,7 @@ public class MapList * returning mapped position */ private int[][] posMap(List shiftTo, int ratio, - List shiftFrom, - int toRatio) + List shiftFrom, int toRatio) { // TODO not used - remove?? int iv = 0, ivSize = shiftTo.size(); @@ -374,9 +370,8 @@ public class MapList } mp[i] = m; } - int[][] map = new int[][] - { new int[] - { from, to, tF, tT }, new int[to - from + 2] }; + int[][] map = new int[][] { new int[] { from, to, tF, tT }, + new int[to - from + 2] }; map[0][2] = tF; map[0][3] = tT; @@ -461,8 +456,7 @@ public class MapList return null; // throw new Error("Bad Mapping!"); } // System.out.println(fromCount[0]+" "+fromCount[1]+" "+toCount); - return new int[] - { toPos[0], fromRemainder, toPos[1] }; + return new int[] { toPos[0], fromRemainder, toPos[1] }; } /** @@ -482,8 +476,7 @@ public class MapList { if (pos >= intv[0] && pos <= intv[1]) { - return new int[] - { count + pos - intv[0] + 1, +1 }; + return new int[] { count + pos - intv[0] + 1, +1 }; } else { @@ -494,8 +487,7 @@ public class MapList { if (pos >= intv[1] && pos <= intv[0]) { - return new int[] - { count + intv[0] - pos + 1, -1 }; + return new int[] { count + intv[0] - pos + 1, -1 }; } else { @@ -516,8 +508,7 @@ public class MapList protected static int[] countToPos(List shiftFrom, int pos) { int count = 0, diff = 0, iv = 0, ivSize = shiftFrom.size(); - int[] intv = - { 0, 0 }; + int[] intv = { 0, 0 }; while (iv < ivSize) { intv = shiftFrom.get(iv++); @@ -526,8 +517,7 @@ public class MapList { if (pos <= count + 1 + diff) { - return new int[] - { pos - count - 1 + intv[0], +1 }; + return new int[] { pos - count - 1 + intv[0], +1 }; } else { @@ -538,8 +528,7 @@ public class MapList { if (pos <= count + 1 - diff) { - return new int[] - { intv[0] - (pos - count - 1), -1 }; + return new int[] { intv[0] - (pos - count - 1), -1 }; } else { @@ -597,8 +586,7 @@ public class MapList * region to final position of ending region inclusive */ protected static int[] getIntervals(List shiftFrom, - int[] fromStart, - int[] fromEnd, int fromRatio2) + int[] fromStart, int[] fromEnd, int fromRatio2) { if (fromStart == null || fromEnd == null) { @@ -688,8 +676,7 @@ public class MapList i = fs; // truncate initial interval iv = shiftFrom.get(intv++); - iv = new int[] - { iv[0], iv[1] };// clone + iv = new int[] { iv[0], iv[1] };// clone if (i == fs) { iv[0] = startpos; @@ -698,8 +685,7 @@ public class MapList { ranges.add(iv); // add initial range iv = shiftFrom.get(intv++); // get next interval - iv = new int[] - { iv[0], iv[1] };// clone + iv = new int[] { iv[0], iv[1] };// clone i++; } if (i == fe) @@ -717,8 +703,7 @@ public class MapList i--; } iv = shiftFrom.get(i); - iv = new int[] - { iv[1], iv[0] };// reverse and clone + iv = new int[] { iv[1], iv[0] };// reverse and clone // truncate initial interval if (i == fs) { @@ -728,8 +713,7 @@ public class MapList { // fix apparent logic bug when fe==-1 ranges.add(iv); // add (truncated) reversed interval iv = shiftFrom.get(i); - iv = new int[] - { iv[1], iv[0] }; // reverse and clone + iv = new int[] { iv[1], iv[0] }; // reverse and clone } if (i == fe) { @@ -788,8 +772,7 @@ public class MapList int[] mp = shiftTo(mpos); if (mp != null) { - return new int[] - { mp[0], mp[0] + mp[2] * (getFromRatio() - 1) }; + return new int[] { mp[0], mp[0] + mp[2] * (getFromRatio() - 1) }; } return null; } @@ -818,8 +801,7 @@ public class MapList int[] mp = shiftFrom(pos); if (mp != null) { - return new int[] - { mp[0], mp[0] + mp[2] * (getToRatio() - 1) }; + return new int[] { mp[0], mp[0] + mp[2] * (getToRatio() - 1) }; } return null; }