{
mfound = true;
matchStart = sequence.findIndex(m.start) - 1;
- matchEnd = m.start == m.end ? matchStart : sequence
- .findIndex(m.end) - 1;
+ matchEnd = m.start == m.end ? matchStart
+ : sequence.findIndex(m.end) - 1;
}
if (mfound)
}
/**
- * Two SearchResults are considered equal if they contain the same matches in
- * the same order.
+ * Two SearchResults are considered equal if they contain the same matches
+ * (Sequence, start position, end position) in the same order
+ *
+ * @see Match#equals(Object)
*/
@Override
public boolean equals(Object obj)
{
matches.addAll(toAdd.getResults());
}
+
+ @Override
+ public List<SequenceI> getMatchingSubSequences()
+ {
+ List<SequenceI> seqs = new ArrayList<>();
+
+ /*
+ * assemble dataset sequences, and template new sequence features,
+ * for the amend features dialog
+ */
+ for (SearchResultMatchI match : matches)
+ {
+ SequenceI seq = match.getSequence();
+ while (seq.getDatasetSequence() != null)
+ {
+ seq = seq.getDatasetSequence();
+ }
+ // getSubSequence is index-base0, findIndex returns index-base1
+ seqs.add(seq.getSubSequence(seq.findIndex(match.getStart()) - 1,
+ seq.findIndex(match.getEnd())));
+ }
+ return seqs;
+ }
}