+ /**
+ * Returns a representation as "seqid/start-end"
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+ if (sequence != null)
+ {
+ sb.append(sequence.getName()).append("/");
+ }
+ sb.append(start).append("-").append(end);
+ return sb.toString();
+ }
+
+ /**
+ * Hashcode is the hashcode of the matched sequence plus a hash of start and
+ * end positions. Match objects that pass the test for equals are guaranteed
+ * to have the same hashcode.
+ */
+ @Override
+ public int hashCode()
+ {
+ int hash = sequence == null ? 0 : sequence.hashCode();
+ hash += 31 * start;
+ hash += 67 * end;
+ return hash;
+ }
+
+ /**
+ * Two Match objects are equal if they are for the same sequence, start and
+ * end positions
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == null || !(obj instanceof SearchResultMatchI))
+ {
+ return false;
+ }
+ SearchResultMatchI m = (SearchResultMatchI) obj;
+ return (sequence == m.getSequence() && start == m.getStart()
+ && end == m.getEnd());
+ }
+
+ @Override
+ public boolean contains(SequenceI seq, int from, int to)
+ {
+ return (sequence == seq && start <= from && end >= to);
+ }