From: amwaterhouse Date: Mon, 24 Jan 2005 17:25:31 +0000 (+0000) Subject: now uses 1.1 friendly regex X-Git-Tag: Release_2_0~730 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=183b98840a8ee8d03a2c7f7f42044190d52f2595;p=jalview.git now uses 1.1 friendly regex --- diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index 1ff31fe..2311a9f 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -6,7 +6,6 @@ import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.util.*; -import java.util.regex.*; import java.awt.*; public class Finder extends GFinder @@ -92,7 +91,7 @@ public class Finder extends GFinder int [] allResults = null; Sequence seq; - String item; + String item=null; boolean found = false; /// is the searchString a residue number? @@ -109,8 +108,6 @@ public class Finder extends GFinder searchResults.add( Integer.toString( seq.findIndex(res)-1 ) ); searchResults.add( Integer.toString( seq.findIndex(res)-1 ) ); - - //av.getAlignment().getSequenceAt(seq).findPosition(res) }catch(NumberFormatException ex){} jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(); @@ -122,10 +119,21 @@ public class Finder extends GFinder searchGroup = new SuperGroup(searchString, ucs , true, true, false); - while( !found && seqIndex0 && !av.getSelection().contains(seq)) + + if( av.getSelection().size()>0 && !av.getSelection().contains(seq) + || (rubberband!=null && !rubberband.sequences.contains(seq)) ) { // if a selection has been made, only search within that selection seqIndex++; @@ -135,6 +143,9 @@ public class Finder extends GFinder item = seq.getSequence(); + if(rubberband!=null) + item = item.substring(0, rubberband.getEndRes()+1); + ///Shall we ignore gaps???? StringBuffer noGaps = new StringBuffer(); int insertCount=0; @@ -153,23 +164,26 @@ public class Finder extends GFinder } - Pattern pattern = Pattern.compile(searchString); - Matcher matcher = pattern.matcher(noGaps); + com.stevesoft.pat.Regex regex = new com.stevesoft.pat.Regex(searchString); for(int r = resIndex; r0) {