X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fanalysis%2FFinder.java;h=faf79d154f71c99427d701bb2585c9558f0d0e60;hb=25aaaa87042b3f507ad4348120df7dd073182759;hp=edf9debf902f4748adb0b1ba091beaba0e7109c3;hpb=ab43013b7e357b84b4abade0dba949668dfb2a0e;p=jalview.git diff --git a/src/jalview/analysis/Finder.java b/src/jalview/analysis/Finder.java index edf9deb..faf79d1 100644 --- a/src/jalview/analysis/Finder.java +++ b/src/jalview/analysis/Finder.java @@ -20,9 +20,12 @@ */ package jalview.analysis; -import java.util.*; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.SearchResults; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceGroup; -import jalview.datamodel.*; +import java.util.Vector; public class Finder { @@ -39,6 +42,8 @@ public class Finder boolean caseSensitive = false; + private boolean includeDescription = false; + boolean findAll = false; com.stevesoft.pat.Regex regex = null; @@ -146,6 +151,19 @@ public class Finder break; } } + + if (isIncludeDescription() && seq.getDescription() != null + && regex.search(seq.getDescription())) + { + idMatch.addElement(seq); + hasResults = true; + if (!findAll) + { + // stop and return the match + found = true; + break; + } + } } item = seq.getSequenceAsString(); @@ -188,7 +206,7 @@ public class Finder { continue; } - +// if invalid string used, then regex has no matched to/from int sres = seq .findPosition(resIndex + Integer.parseInt(spaces.elementAt(resIndex) @@ -358,4 +376,14 @@ public class Finder { this.seqIndex = seqIndex; } + + public boolean isIncludeDescription() + { + return includeDescription; + } + + public void setIncludeDescription(boolean includeDescription) + { + this.includeDescription = includeDescription; + } }