From: Jim Procter Date: Wed, 7 Oct 2015 11:51:27 +0000 (+0100) Subject: JAL-1912 efficiency: look up sequenceMapping once per position and only when sequence... X-Git-Tag: Release_2_10_0~365^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5935396709349dbe2926fa1ad0dd24995712b77b;p=jalview.git JAL-1912 efficiency: look up sequenceMapping once per position and only when sequenceMapping!=null --- diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 01926dc..b00f27d 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -980,18 +980,20 @@ public class AlignmentAnnotation int position; Annotation[] temp = new Annotation[aSize]; Integer index; - - for (a = sequenceRef.getStart(); a <= sequenceRef.getEnd(); a++) + if (sequenceMapping != null) { - index = new Integer(a); - if (sequenceMapping != null && sequenceMapping.containsKey(index)) + for (a = sequenceRef.getStart(); a <= sequenceRef.getEnd(); a++) { - position = sequenceRef.findIndex(a) - 1; + index = new Integer(a); + Annotation annot = sequenceMapping.get(index); + if (annot != null) + { + position = sequenceRef.findIndex(a) - 1; - temp[position] = sequenceMapping.get(index); + temp[position] = annot; + } } } - annotations = temp; }