SequenceI seq = new Sequence("seq", "ABC--DEF");
seq.createDatasetSequence();
assertEquals("ABCDEF", seq.getDatasetSequence().getSequenceAsString());
+ assertEquals(1, seq.getStart());
+ assertEquals(6, seq.getEnd());
/*
* replace C- with XYZ
* NB arg4 = start column of selection for edit (base 0)
* arg5 = column after end of selection for edit
*/
- new EditCommand("", Action.REPLACE, "XYZ", new SequenceI[] { seq }, 2,
+ EditCommand edit = new EditCommand("", Action.REPLACE, "XYZ",
+ new SequenceI[]
+ { seq }, 2,
4, al);
assertEquals("ABXYZ-DEF", seq.getSequenceAsString());
+ assertEquals(1, seq.getStart());
+ assertEquals(7, seq.getEnd());
assertEquals("ABXYZDEF", seq.getDatasetSequence().getSequenceAsString());
+ assertEquals(7, seq.getDatasetSequence().getEnd());
+
+ edit.undoCommand(
+ new AlignmentI[]
+ { new Alignment(new SequenceI[] { seq }) });
+
+ assertEquals("ABC--DEF", seq.getSequenceAsString());
+ assertEquals("ABCDEF", seq.getDatasetSequence().getSequenceAsString());
+ assertEquals(1, seq.getStart());
+ assertEquals(6, seq.getEnd());
+ assertEquals(6, seq.getDatasetSequence().getEnd());
+
+ edit.undoCommand(
+ new AlignmentI[]
+ { new Alignment(new SequenceI[] { seq }) });
+
+ assertEquals("ABXYZ-DEF", seq.getSequenceAsString());
+ assertEquals(1, seq.getStart());
+ assertEquals(7, seq.getEnd());
+ assertEquals("ABXYZDEF",
+ seq.getDatasetSequence().getSequenceAsString());
+ assertEquals(7, seq.getDatasetSequence().getEnd());
+
}
/**