- * This Method returns the search matches which lie between the
- * start and end points of the sequence in question. It is
- * optimised for returning objects for drawing on SequenceCanvas
+ * This method replaces the old search results which merely held an alignment
+ * index of search matches. This broke when sequences were moved around the
+ * alignment
+ *
+ * @param seq
+ * Sequence
+ * @param start
+ * int
+ * @param end
+ * int
+ */
+ public void addResult(SequenceI seq, int start, int end)
+ {
+ matches.add(new Match(seq, start, end));
+ }
+
+ /**
+ * Quickly check if the given sequence is referred to in the search results
+ *
+ * @param sequence
+ * (specific alignment sequence or a dataset sequence)
+ * @return true if the results involve sequence
+ */
+ public boolean involvesSequence(SequenceI sequence)
+ {
+ SequenceI ds = sequence.getDatasetSequence();
+ for (Match m : matches)
+ {
+ if (m.sequence != null
+ && (m.sequence == sequence || m.sequence == ds))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * This Method returns the search matches which lie between the start and end
+ * points of the sequence in question. It is optimised for returning objects
+ * for drawing on SequenceCanvas