JAL-966 JAL-1738 JAL-345 interfaces for SearchResults and SearchResults.Match
[jalview.git] / src / jalview / datamodel / SearchResultsI.java
1 package jalview.datamodel;
2
3 import jalview.datamodel.SearchResults.Match;
4
5 import java.util.List;
6
7 public interface SearchResultsI
8 {
9
10   /**
11    * This method replaces the old search results which merely held an alignment
12    * index of search matches. This broke when sequences were moved around the
13    * alignment
14    * 
15    * @param seq
16    *          Sequence
17    * @param start
18    *          int
19    * @param end
20    *          int
21    */
22   public abstract void addResult(SequenceI seq, int start, int end);
23
24   /**
25    * Quickly check if the given sequence is referred to in the search results
26    * 
27    * @param sequence
28    *          (specific alignment sequence or a dataset sequence)
29    * @return true if the results involve sequence
30    */
31   public abstract boolean involvesSequence(SequenceI sequence);
32
33   /**
34    * This Method returns the search matches which lie between the start and end
35    * points of the sequence in question. It is optimised for returning objects
36    * for drawing on SequenceCanvas
37    */
38   public abstract int[] getResults(SequenceI sequence, int start, int end);
39
40   public abstract int getSize();
41
42   public abstract SequenceI getResultSequence(int index);
43
44   /**
45    * Returns the start position of the i'th match in the search results.
46    * 
47    * @param i
48    * @return
49    */
50   public abstract int getResultStart(int i);
51
52   /**
53    * Returns the end position of the i'th match in the search results.
54    * 
55    * @param i
56    * @return
57    */
58   public abstract int getResultEnd(int i);
59
60   /**
61    * Returns true if no search result matches are held.
62    * 
63    * @return
64    */
65   public abstract boolean isEmpty();
66
67   /**
68    * Returns the list of matches.
69    * 
70    * @return
71    */
72   public abstract List<Match> getResults();
73
74 }