+
+ @Override
+ public int hashCode()
+ {
+ int hash = 31 * residuePosition;
+ hash = 31 * hash + columnPosition;
+ hash = 31 * hash + token;
+ if (sequence != null)
+ {
+ hash += sequence.hashCode();
+ }
+ return hash;
+ }
+
+ /**
+ * Two cursors are equal if they refer to the same sequence object and have
+ * the same residue position, column position and token value
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof SequenceCursor))
+ {
+ return false;
+ }
+ SequenceCursor sc = (SequenceCursor) obj;
+ return sequence == sc.sequence && residuePosition == sc.residuePosition
+ && columnPosition == sc.columnPosition && token == sc.token;
+ }
+
+ @Override
+ public String toString()
+ {
+ String name = sequence == null ? "" : sequence.getName();
+ return String.format("%s:Pos%d:Col%d:startCol%d:endCol%d:tok%d", name,
+ residuePosition, columnPosition, firstColumnPosition,
+ lastColumnPosition, token);
+ }