Revision: 20260
          http://sourceforge.net/p/jmol/code/20260
Author:   hansonr
Date:     2015-01-30 15:43:23 +0000 (Fri, 30 Jan 2015)
Log Message:
-----------


Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java

Modified: trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java   2015-01-30 14:45:43 UTC 
(rev 20259)
+++ trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java   2015-01-30 15:43:23 UTC 
(rev 20260)
@@ -371,28 +371,29 @@
           if (chainID == -1 || chainID == (id = chain.chainID) || 
!caseSensitive
               && id > 0 && id < 300 && chainID == 
AtomCollection.chainToUpper(id)) {
             Group[] groups = chain.groups;
+            int n = chain.groupCount;
             for (int index = 0; index >= 0;) 
-              index = selectSeqcodeRange(groups, index, seqcodeA, seqcodeB, 
bs);
+              index = selectSeqcodeRange(groups, n, index, seqcodeA, seqcodeB, 
bs);
           }
         }
       }
     return bs;
   }
 
-  private int selectSeqcodeRange(Group[] groups, int index, int seqcodeA, int 
seqcodeB,
+  private static int selectSeqcodeRange(Group[] groups, int n, int index, int 
seqcodeA, int seqcodeB,
                                 BS bs) {
     int seqcode, indexA, indexB, minDiff;
     boolean isInexact = false;
-    for (indexA = index; indexA < groupCount
+    for (indexA = index; indexA < n
         && groups[indexA].seqcode != seqcodeA; indexA++) {
     }
-    if (indexA == groupCount) {
+    if (indexA == n) {
       // didn't find A exactly -- go find the nearest that is GREATER than 
this value
       if (index > 0)
         return -1;
       isInexact = true;
       minDiff = Integer.MAX_VALUE;
-      for (int i = groupCount; --i >= 0;)
+      for (int i = n; --i >= 0;)
         if ((seqcode = groups[i].seqcode) > seqcodeA
             && (seqcode - seqcodeA) < minDiff) {
           indexA = i;
@@ -402,19 +403,19 @@
         return -1;
     }
     if (seqcodeB == Integer.MAX_VALUE) {
-      indexB = groupCount - 1;
+      indexB = n - 1;
       isInexact = true;
     } else {
-      for (indexB = indexA; indexB < groupCount
+      for (indexB = indexA; indexB < n
           && groups[indexB].seqcode != seqcodeB; indexB++) {
       }
-      if (indexB == groupCount) {
+      if (indexB == n) {
         // didn't find B exactly -- get the nearest that is LESS than this 
value
         if (index > 0)
           return -1;
         isInexact = true;
         minDiff = Integer.MAX_VALUE;
-        for (int i = indexA; i < groupCount; i++)
+        for (int i = indexA; i < n; i++)
           if ((seqcode = groups[i].seqcode) < seqcodeB
               && (seqcodeB - seqcode) < minDiff) {
             indexB = i;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to