From 73e6ed31b0328def2a94c643fc71380acf16d17c Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 22 Sep 2005 15:48:39 +0000 Subject: [PATCH] Break if regex not found --- src/jalview/appletgui/Finder.java | 2 ++ src/jalview/gui/Finder.java | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) 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) -- 1.7.10.2