JAL-2933 gui and applet Finder hold a FinderI per viewport
[jalview.git] / src / jalview / api / FinderI.java
1 package jalview.api;
2
3 import jalview.datamodel.SearchResultsI;
4 import jalview.datamodel.SequenceGroup;
5 import jalview.datamodel.SequenceI;
6
7 import java.util.List;
8
9 /**
10  * An interface for searching for a pattern in an aligment
11  */
12 public interface FinderI
13 {
14
15   /**
16    * Performs a find for the given search string (interpreted as a regular
17    * expression). Search may optionally be case-sensitive, and may optionally
18    * including match in sequence description (sequence id is always searched).
19    * If <code>selection</code> is not null, then the find is restricted to the
20    * selection region. Sequences matched by id or description can be retrieved
21    * by getIdMatches(), and matched residue patterns by getSearchResults().
22    * 
23    * @param theSearchString
24    * @param caseSensitive
25    * @param searchDescription
26    * @return
27    */
28   void findAll(String theSearchString, SequenceGroup selection,
29           boolean caseSensitive, boolean searchDescription);
30
31   /**
32    * Finds the next match for the given search string (interpreted as a regular
33    * expression), starting from the position after the last match found. Search
34    * may optionally be case-sensitive, and may optionally including match in
35    * sequence description (sequence id is always searched). If
36    * <code>selection</code> is not null, then the find is restricted to the
37    * selection region. Sequences matched by id or description can be retrieved
38    * by getIdMatches(), and matched residue patterns by getSearchResults().
39    * 
40    * @param theSearchString
41    * @param selection
42    * @param caseSensitive
43    * @param searchDescription
44    * @return
45    */
46   void findNext(String theSearchString, SequenceGroup selection,
47           boolean caseSensitive, boolean searchDescription);
48
49   /**
50    * Returns the (possibly empty) list of sequences matched on sequence name or
51    * description
52    * 
53    * @return
54    */
55   List<SequenceI> getIdMatches();
56
57   /**
58    * Answers the search results (possibly empty) from the last search
59    * 
60    * @return
61    */
62   SearchResultsI getSearchResults();
63
64 }