- /**
- * 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
- */
+ @Override
+ public SearchResultMatchI addResult(SequenceI seq, int start, int end)
+ {
+ Match m = new Match(seq, start, end);
+ if (!matches.contains(m))
+ {
+ matches.add(m);
+ count++;
+ }
+ return m;
+ }
+
+ @Override
+ public void addResult(SequenceI seq, int[] positions)
+ {
+ /*
+ * we only increment the match count by 1 - or not at all,
+ * if the matches are all duplicates of existing
+ */
+ int beforeCount = count;
+ for (int i = 0; i < positions.length - 1; i += 2)
+ {
+ addResult(seq, positions[i], positions[i + 1]);
+ }
+ if (count > beforeCount)
+ {
+ count = beforeCount + 1;
+ }
+ }
+
+ @Override
+ public boolean involvesSequence(SequenceI sequence)
+ {
+ final int start = sequence.getStart();
+ final int end = sequence.getEnd();
+
+ SequenceI ds = sequence.getDatasetSequence();
+ for (SearchResultMatchI m : matches)
+ {
+ SequenceI matched = m.getSequence();
+ if (matched != null && (matched == sequence || matched == ds)
+ && (m.getEnd() >= start) && (m.getStart() <= end))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override