X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fcommands%2FRemoveGapColCommand.java;h=2c3aced98760b033ec38d59714d1f1f322657f90;hb=d587f1aa61946dc14f6f089cf1dc2a3116cfb773;hp=5bf5b6100f5d005e47c9ca6ea26e431cfee62397;hpb=8787ad51b5206692859df9b84e836a01e7a91c02;p=jalview.git diff --git a/src/jalview/commands/RemoveGapColCommand.java b/src/jalview/commands/RemoveGapColCommand.java index 5bf5b61..2c3aced 100644 --- a/src/jalview/commands/RemoveGapColCommand.java +++ b/src/jalview/commands/RemoveGapColCommand.java @@ -22,6 +22,7 @@ import jalview.datamodel.*; public class RemoveGapColCommand extends EditCommand { + int columnsDeleted; public RemoveGapColCommand(String description, SequenceI[] seqs, int start, int end, char gapChar) @@ -31,12 +32,12 @@ public class RemoveGapColCommand extends EditCommand int j, jSize = seqs.length; int startCol = -1, endCol = -1; - int deletedCols = 0; + columnsDeleted=0; edits = new Edit[0]; boolean delete = true; - for (int i = start; i < end; i++) + for (int i = start; i <= end; i++) { delete = true; @@ -63,12 +64,12 @@ public class RemoveGapColCommand extends EditCommand if (!delete && startCol > -1) { this.appendEdit(DELETE_GAP, seqs, - startCol - deletedCols, + startCol - columnsDeleted, endCol - startCol, gapChar, false); - deletedCols += (endCol - startCol); + columnsDeleted += (endCol - startCol); startCol = -1; endCol = -1; } @@ -78,14 +79,25 @@ public class RemoveGapColCommand extends EditCommand { //This is for empty columns at the //end of the alignment + this.appendEdit(DELETE_GAP, seqs, - startCol - deletedCols, - end-startCol+1, + startCol - columnsDeleted, + end - startCol +1, gapChar, false); + + columnsDeleted += (end - startCol +1); } + performEdit(0); } + public int getSize() + { + //We're interested in the number of columns deleted, + //Not the number of sequence edits. + return columnsDeleted; + } + }