From c33d6e5a2579132d96ed17bdf17b523d4bf43c4b Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 2 May 2007 14:28:40 +0000 Subject: [PATCH] fixed getIntervals bug to ensure it returns range from start of token at fromPosition to end of token in toPosition in the direction from fromPosition to toPosition --- src/jalview/util/MapList.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/jalview/util/MapList.java b/src/jalview/util/MapList.java index 826ead7..2464264 100644 --- a/src/jalview/util/MapList.java +++ b/src/jalview/util/MapList.java @@ -446,15 +446,13 @@ public class MapList * @param fromStart * @param fromEnd * @param fromRatio2 - * @return + * @return series of from,to intervals from from first position of starting region to final position of ending region inclusive */ private int[] getIntervals(Vector fromShifts2, int[] fromStart, int[] fromEnd, int fromRatio2) { - // TODO: correct for word boundary w.r.t. fromStart->fromEnd direction for startpos and endpos. - // test is (1,8,12,17) to (1,5) and features on to : 2,2; 3,3; 4,3; 3,4; 4,4; 5,3; 3,5; 2,4; 4,2; - // correct for word direction for start and end : - int startpos = fromStart[0]+fromStart[2]*(fromRatio2-1); // Math.min(fromStart[0], .. ); - int endpos = fromEnd[0]+fromEnd[2]*(fromRatio2-1); // Math.max(fromEnd[0],); + int startpos,endpos; + startpos = fromStart[0]; // first position in fromStart + endpos = fromEnd[0]+fromEnd[2]*(fromRatio2-1); // last position in fromEnd int intv=0,intvSize= fromShifts2.size(); int iv[],i=0,fs=-1,fe=-1; // containing intervals while (intv