X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequenceCursor.java;h=b5929bfb2b56debcda051078a003b78ea125c8b0;hb=004a35d07335854184fdd335920b7210eebd66d9;hp=f439ee162ab4caca69c5b13199fd5a6e7a0dc20b;hpb=70a93ebbabd80e25c60a0e6444013ed4260b09a5;p=jalview.git diff --git a/src/jalview/datamodel/SequenceCursor.java b/src/jalview/datamodel/SequenceCursor.java index f439ee1..b5929bf 100644 --- a/src/jalview/datamodel/SequenceCursor.java +++ b/src/jalview/datamodel/SequenceCursor.java @@ -22,6 +22,16 @@ public class SequenceCursor public final int columnPosition; /** + * column position (1...) of first residue in the sequence, or 0 if undefined + */ + public final int firstColumnPosition; + + /** + * column position (1...) of last residue in the sequence, or 0 if undefined + */ + public final int lastColumnPosition; + + /** * a token which may be used to check whether this cursor is still valid for * its sequence (allowing it to be ignored if the sequence has changed) */ @@ -42,9 +52,36 @@ public class SequenceCursor */ public SequenceCursor(SequenceI seq, int resPos, int column, int tok) { + this(seq, resPos, column, 0, 0, tok); + } + + /** + * Constructor + * + * @param seq + * sequence this cursor applies to + * @param resPos + * residue position in sequence (start..) + * @param column + * column position in alignment (1..) + * @param firstResCol + * column position of the first residue in the sequence (1..), or 0 + * if not known + * @param lastResCol + * column position of the last residue in the sequence (1..), or 0 if + * not known + * @param tok + * a token that may be validated by the sequence to check the cursor + * is not stale + */ + public SequenceCursor(SequenceI seq, int resPos, int column, int firstResCol, + int lastResCol, int tok) + { sequence = seq; residuePosition = resPos; columnPosition = column; + firstColumnPosition = firstResCol; + lastColumnPosition = lastResCol; token = tok; } @@ -80,7 +117,9 @@ public class SequenceCursor @Override public String toString() { - return (sequence == null ? "" : sequence.getName()) + ":Pos" - + residuePosition + ":Col" + columnPosition + ":tok" + token; + 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); } }