Merge branch 'features/JAL-4071_visibleFeaturesCounter' into features/JAL-3417_sdppre...
[jalview.git] / src / jalview / datamodel / Alignment.java
index 09c69e2..f389ad8 100755 (executable)
@@ -202,6 +202,7 @@ public class Alignment implements AlignmentI, AutoCloseable
   {
     synchronized (sequences)
     {
+
       if (i > -1 && i < sequences.size())
       {
         return sequences.get(i);
@@ -601,11 +602,12 @@ public class Alignment implements AlignmentI, AutoCloseable
     int i = 0;
     SequenceI sq = null;
     String sqname = null;
+    int nseq = sequences.size();
     if (startAfter != null)
     {
       // try to find the sequence in the alignment
       boolean matched = false;
-      while (i < sequences.size())
+      while (i < nseq)
       {
         if (getSequenceAt(i++) == startAfter)
         {
@@ -618,7 +620,7 @@ public class Alignment implements AlignmentI, AutoCloseable
         i = 0;
       }
     }
-    while (i < sequences.size())
+    while (i < nseq)
     {
       sq = getSequenceAt(i);
       sqname = sq.getName();
@@ -721,7 +723,7 @@ public class Alignment implements AlignmentI, AutoCloseable
   public int getWidth()
   {
     int maxLength = -1;
-  
+
     for (int i = 0; i < sequences.size(); i++)
     {
       maxLength = Math.max(maxLength, getSequenceAt(i).getLength());
@@ -1200,7 +1202,8 @@ public class Alignment implements AlignmentI, AutoCloseable
     int maxLength = -1;
 
     SequenceI current;
-    for (int i = 0; i < sequences.size(); i++)
+    int nseq = sequences.size();
+    for (int i = 0; i < nseq; i++)
     {
       current = getSequenceAt(i);
       for (int j = current.getLength(); j > maxLength; j--)
@@ -1217,7 +1220,7 @@ public class Alignment implements AlignmentI, AutoCloseable
     maxLength++;
 
     int cLength;
-    for (int i = 0; i < sequences.size(); i++)
+    for (int i = 0; i < nseq; i++)
     {
       current = getSequenceAt(i);
       cLength = current.getLength();