Merge branch 'develop' into features/r2_11_2_alphafold/JAL-2349_JAL-3855
[jalview.git] / src / jalview / datamodel / SearchResultsI.java~
1 package jalview.datamodel;
2
3 import java.util.BitSet;
4 import java.util.List;
5
6 /**
7  * An interface describing the result of a search or other operation which
8  * highlights matched regions of an alignment
9  */
10 public interface SearchResultsI
11 {
12
13   /**
14    * Adds one region to the results
15    * 
16    * @param seq
17    *          Sequence
18    * @param start
19    *          int
20    * @param end
21    *          int
22    * @return
23    */
24   SearchResultMatchI addResult(SequenceI seq, int start, int end);
25
26   /**
27    * Answers true if the search results include the given sequence (or its
28    * dataset sequence), else false
29    * 
30    * @param sequence
31    * @return
32    */
33   boolean involvesSequence(SequenceI sequence);
34
35   /**
36    * Returns an array of [from, to, from, to..] matched columns (base 0) between
37    * the given start and end columns of the given sequence. Returns null if no
38    * matches overlap the specified region.
39    * <p>
40    * Implementations should provide an optimised method to return locations to
41    * highlight on a visible portion of an alignment.
42    * 
43    * @param sequence
44    * @param start
45    *          first column of range (base 0, inclusive)
46    * @param end
47    *          last column of range base 0, inclusive)
48    * @return int[]
49    */
50   int[] getResults(SequenceI sequence, int start, int end);
51
52   /**
53    * Returns the number of matches found
54    * 
55    * @return
56    */
57   int getSize();
58
59   /**
60    * Returns true if no search result matches are held.
61    * 
62    * @return
63    */
64   boolean isEmpty();
65
66   /**
67    * Returns the list of matches.
68    * 
69    * @return
70    */
71   List<SearchResultMatchI> getResults();
72
73   /**
74    * Set bits in a bitfield for all columns in the given sequence collection
75    * that are highlighted
76    * 
77    * @param sqcol
78    *          the set of sequences to search for highlighted regions
79    * @param bs
80    *          bitset to set
81    * @return number of bits set
82    */
83   int markColumns(SequenceCollectionI sqcol, BitSet bs);
84 }