Class | Line # | Actions | |||
---|---|---|---|---|---|
SearchResultsI | 30 | 0 | 0 |
1 | /* | |
2 | * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) | |
3 | * Copyright (C) $$Year-Rel$$ The Jalview Authors | |
4 | * | |
5 | * This file is part of Jalview. | |
6 | * | |
7 | * Jalview is free software: you can redistribute it and/or | |
8 | * modify it under the terms of the GNU General Public License | |
9 | * as published by the Free Software Foundation, either version 3 | |
10 | * of the License, or (at your option) any later version. | |
11 | * | |
12 | * Jalview is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty | |
14 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
15 | * PURPOSE. See the GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with Jalview. If not, see <http://www.gnu.org/licenses/>. | |
19 | * The Jalview Authors are detailed in the 'AUTHORS' file. | |
20 | */ | |
21 | package jalview.datamodel; | |
22 | ||
23 | import java.util.BitSet; | |
24 | import java.util.List; | |
25 | ||
26 | /** | |
27 | * An interface describing the result of a search or other operation which | |
28 | * highlights matched regions of an alignment | |
29 | */ | |
30 | public interface SearchResultsI | |
31 | { | |
32 | ||
33 | /** | |
34 | * Adds one region to the results (unless already added, to avoid duplicates) | |
35 | * | |
36 | * @param seq | |
37 | * @param start | |
38 | * @param end | |
39 | * @return | |
40 | */ | |
41 | SearchResultMatchI addResult(SequenceI seq, int start, int end); | |
42 | ||
43 | /** | |
44 | * adds all match results in the argument to this set | |
45 | * | |
46 | * @param toAdd | |
47 | */ | |
48 | void addSearchResults(SearchResultsI toAdd); | |
49 | ||
50 | /** | |
51 | * Answers true if the search results include the given sequence (or its | |
52 | * dataset sequence), else false | |
53 | * | |
54 | * @param sequence | |
55 | * @return | |
56 | */ | |
57 | boolean involvesSequence(SequenceI sequence); | |
58 | ||
59 | /** | |
60 | * Returns an array of [from, to, from, to..] matched columns (base 0) between | |
61 | * the given start and end columns of the given sequence. Returns null if no | |
62 | * matches overlap the specified region. | |
63 | * <p> | |
64 | * Implementations should provide an optimised method to return locations to | |
65 | * highlight on a visible portion of an alignment. | |
66 | * | |
67 | * @param sequence | |
68 | * @param start | |
69 | * first column of range (base 0, inclusive) | |
70 | * @param end | |
71 | * last column of range base 0, inclusive) | |
72 | * @return int[] | |
73 | */ | |
74 | int[] getResults(SequenceI sequence, int start, int end); | |
75 | ||
76 | /** | |
77 | * Returns the number of matches found | |
78 | * | |
79 | * @return | |
80 | */ | |
81 | int getSize(); | |
82 | ||
83 | /** | |
84 | * Returns true if no search result matches are held. | |
85 | * | |
86 | * @return | |
87 | */ | |
88 | boolean isEmpty(); | |
89 | ||
90 | /** | |
91 | * Returns the list of matches. | |
92 | * | |
93 | * @return | |
94 | */ | |
95 | List<SearchResultMatchI> getResults(); | |
96 | ||
97 | /** | |
98 | * Set bits in a bitfield for all columns in the given sequence collection | |
99 | * that are highlighted | |
100 | * | |
101 | * @param sqcol | |
102 | * the set of sequences to search for highlighted regions | |
103 | * @param bs | |
104 | * bitset to set | |
105 | * @return number of bits set | |
106 | */ | |
107 | int markColumns(SequenceCollectionI sqcol, BitSet bs); | |
108 | } |