X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fapi%2FFinderI.java;fp=src%2Fjalview%2Fapi%2FFinderI.java;h=19f6136a3a5740129f0a0869a56ceb22afb7889e;hb=ca8504cf9d10874dce9f07cf7a9d933853fe0dd0;hp=0000000000000000000000000000000000000000;hpb=775e7bc104584e88dddcea73fbf02c66f5200c16;p=jalview.git diff --git a/src/jalview/api/FinderI.java b/src/jalview/api/FinderI.java new file mode 100644 index 0000000..19f6136 --- /dev/null +++ b/src/jalview/api/FinderI.java @@ -0,0 +1,62 @@ +package jalview.api; + +import jalview.datamodel.SearchResultsI; +import jalview.datamodel.SequenceI; + +import java.util.List; + +/** + * An interface for searching for a pattern in an aligment + */ +public interface FinderI +{ + + /** + * Performs a find for the given search string (interpreted as a regular + * expression). Search may optionally be case-sensitive, and may optionally + * including match in sequence description (sequence id is always searched). + * If the viewport has an active selection, then the find is restricted to the + * selection region. Sequences matched by id or description can be retrieved + * by getIdMatches(), and matched residue patterns by getSearchResults(). + * + * @param theSearchString + * @param caseSensitive + * @param searchDescription + * @return + */ + void findAll(String theSearchString, boolean caseSensitive, + boolean searchDescription); + + /** + * Finds the next match for the given search string (interpreted as a regular + * expression), starting from the position after the last match found. Search + * may optionally be case-sensitive, and may optionally including match in + * sequence description (sequence id is always searched). If the viewport has + * an active selection, then the find is restricted to the selection region. + * Sequences matched by id or description can be retrieved by getIdMatches(), + * and matched residue patterns by getSearchResults(). + * + * @param theSearchString + * @param caseSensitive + * @param searchDescription + * @return + */ + void findNext(String theSearchString, boolean caseSensitive, + boolean searchDescription); + + /** + * Returns the (possibly empty) list of sequences matched on sequence name or + * description + * + * @return + */ + List getIdMatches(); + + /** + * Answers the search results (possibly empty) from the last search + * + * @return + */ + SearchResultsI getSearchResults(); + +} \ No newline at end of file