Break if regex not found
authoramwaterhouse <Andrew Waterhouse>
Thu, 22 Sep 2005 15:48:39 +0000 (15:48 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 22 Sep 2005 15:48:39 +0000 (15:48 +0000)
src/jalview/appletgui/Finder.java
src/jalview/gui/Finder.java

index 06fc9e1..7cb3763 100755 (executable)
@@ -246,6 +246,8 @@ public class Finder
 \r
           r = resIndex;\r
         }\r
+        else\r
+          break;\r
       }\r
       if (!found)\r
       {\r
index e5c94bd..ec45b0c 100755 (executable)
@@ -260,7 +260,7 @@ public class Finder extends GFinder
             }\r
 \r
             ///Shall we ignore gaps????\r
-            StringBuffer noGaps = new StringBuffer();\r
+            StringBuffer noGapsSB = new StringBuffer();\r
             int insertCount = 0;\r
             Vector spaces = new Vector();\r
 \r
@@ -268,7 +268,7 @@ public class Finder extends GFinder
             {\r
                 if (!jalview.util.Comparison.isGap(item.charAt(j)))\r
                 {\r
-                    noGaps.append(item.charAt(j));\r
+                    noGapsSB.append(item.charAt(j));\r
                     spaces.add(new Integer(insertCount));\r
                 }\r
                 else\r
@@ -277,9 +277,12 @@ public class Finder extends GFinder
                 }\r
             }\r
 \r
+            String noGaps = noGapsSB.toString();\r
+\r
             for (int r = resIndex; r < noGaps.length(); r++)\r
             {\r
-                if (regex.searchFrom(noGaps.toString(), r))\r
+\r
+                if (regex.searchFrom(noGaps, r))\r
                 {\r
                     resIndex = regex.matchedFrom();\r
 \r
@@ -313,6 +316,10 @@ public class Finder extends GFinder
 \r
                     r = resIndex;\r
                 }\r
+                else\r
+                {\r
+                  break;\r
+                }\r
             }\r
 \r
             if (!found)\r