From: amwaterhouse Date: Thu, 22 Sep 2005 15:48:39 +0000 (+0000) Subject: Break if regex not found X-Git-Tag: Release_2_06~23 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=73e6ed31b0328def2a94c643fc71380acf16d17c;p=jalview.git Break if regex not found --- diff --git a/src/jalview/appletgui/Finder.java b/src/jalview/appletgui/Finder.java index 06fc9e1..7cb3763 100755 --- a/src/jalview/appletgui/Finder.java +++ b/src/jalview/appletgui/Finder.java @@ -246,6 +246,8 @@ public class Finder r = resIndex; } + else + break; } if (!found) { diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index e5c94bd..ec45b0c 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -260,7 +260,7 @@ public class Finder extends GFinder } ///Shall we ignore gaps???? - StringBuffer noGaps = new StringBuffer(); + StringBuffer noGapsSB = new StringBuffer(); int insertCount = 0; Vector spaces = new Vector(); @@ -268,7 +268,7 @@ public class Finder extends GFinder { if (!jalview.util.Comparison.isGap(item.charAt(j))) { - noGaps.append(item.charAt(j)); + noGapsSB.append(item.charAt(j)); spaces.add(new Integer(insertCount)); } else @@ -277,9 +277,12 @@ public class Finder extends GFinder } } + String noGaps = noGapsSB.toString(); + for (int r = resIndex; r < noGaps.length(); r++) { - if (regex.searchFrom(noGaps.toString(), r)) + + if (regex.searchFrom(noGaps, r)) { resIndex = regex.matchedFrom(); @@ -313,6 +316,10 @@ public class Finder extends GFinder r = resIndex; } + else + { + break; + } } if (!found)