JAL-345 JAL-1738 SearchResultI method to mark columns in a bitset for highlighted...
[jalview.git] / src / jalview / datamodel / SearchResultsI.java
1 package jalview.datamodel;
2
3 import jalview.datamodel.SearchResults.Match;
4
5 import java.util.BitSet;
6 import java.util.List;
7
8 public interface SearchResultsI
9 {
10
11   /**
12    * This method replaces the old search results which merely held an alignment
13    * index of search matches. This broke when sequences were moved around the
14    * alignment
15    * 
16    * @param seq
17    *          Sequence
18    * @param start
19    *          int
20    * @param end
21    *          int
22    */
23   public abstract void addResult(SequenceI seq, int start, int end);
24
25   /**
26    * Quickly check if the given sequence is referred to in the search results
27    * 
28    * @param sequence
29    *          (specific alignment sequence or a dataset sequence)
30    * @return true if the results involve sequence
31    */
32   public abstract boolean involvesSequence(SequenceI sequence);
33
34   /**
35    * This Method returns the search matches which lie between the start and end
36    * points of the sequence in question . It is optimised for returning objects
37    * for drawing on SequenceCanvas
38    * 
39    * @param sequence
40    *          sequence to highlight columns according to matches
41    * @param start
42    *          - first column of visible region
43    * @param end
44    *          - last column of visible region
45    * @return int[] ranges within start/end index on sequence
46    */
47   public abstract int[] getResults(SequenceI sequence, int start, int end);
48
49   public abstract int getSize();
50
51   public abstract SequenceI getResultSequence(int index);
52
53   /**
54    * Returns the start position of the i'th match in the search results.
55    * 
56    * @param i
57    * @return
58    */
59   public abstract int getResultStart(int i);
60
61   /**
62    * Returns the end position of the i'th match in the search results.
63    * 
64    * @param i
65    * @return
66    */
67   public abstract int getResultEnd(int i);
68
69   /**
70    * Returns true if no search result matches are held.
71    * 
72    * @return
73    */
74   public abstract boolean isEmpty();
75
76   /**
77    * Returns the list of matches.
78    * 
79    * @return
80    */
81   public abstract List<Match> getResults();
82
83   /**
84    * Set bits in a bitfield for all columns in the given sequence collection
85    * that are highlighted
86    * 
87    * @param sqcol
88    *          the set of sequences to search for highlighted regions
89    * @param bs
90    *          bitset to set
91    * @return number of bits set
92    */
93   public abstract int markColumns(SequenceCollectionI sqcol, BitSet bs);
94 }