1 package jalview.datamodel;
4 * Data bean that holds a mapping from one sequence to another
6 public class SequenceMapping
12 private MappingType type;
14 SequenceMapping(SequenceI from, Mapping map)
21 * Readable representation for debugging only, not guaranteed not to change
24 public String toString()
26 return String.format("From %s %s", fromSeq.getName(),
31 * Returns a hashCode derived from the hashcodes of the mappings and fromSeq
33 * @see SequenceMapping#hashCode()
38 return (fromSeq == null ? 0 : fromSeq.hashCode() * 31)
43 * Answers true if the objects hold the same mapping between the same two
49 public boolean equals(Object obj)
51 if (!(obj instanceof SequenceMapping))
55 SequenceMapping that = (SequenceMapping) obj;
56 if (this.mapping == null)
58 return that.mapping == null;
60 // TODO: can simplify by asserting fromSeq is a dataset sequence
61 return (this.fromSeq == that.fromSeq
62 || (this.fromSeq != null && that.fromSeq != null
63 && this.fromSeq.getDatasetSequence() != null
64 && this.fromSeq.getDatasetSequence() == that.fromSeq
65 .getDatasetSequence()))
66 && this.mapping.equals(that.mapping);
69 public SequenceI getFromSeq()
74 public Mapping getMapping()
79 public MappingType getType()