\r
public class RemoveGapColCommand extends EditCommand\r
{\r
+ int columnsDeleted;\r
public RemoveGapColCommand(String description,\r
SequenceI[] seqs,\r
int start, int end, char gapChar)\r
int j, jSize = seqs.length;\r
\r
int startCol = -1, endCol = -1;\r
- int deletedCols = 0;\r
+ columnsDeleted=0;\r
\r
edits = new Edit[0];\r
\r
boolean delete = true;\r
- for (int i = start; i < end; i++)\r
+ for (int i = start; i <= end; i++)\r
{\r
delete = true;\r
\r
if (!delete && startCol > -1)\r
{\r
this.appendEdit(DELETE_GAP, seqs,\r
- startCol - deletedCols,\r
+ startCol - columnsDeleted,\r
endCol - startCol,\r
gapChar,\r
false);\r
\r
- deletedCols += (endCol - startCol);\r
+ columnsDeleted += (endCol - startCol);\r
startCol = -1;\r
endCol = -1;\r
}\r
{\r
//This is for empty columns at the\r
//end of the alignment\r
+\r
this.appendEdit(DELETE_GAP, seqs,\r
- startCol - deletedCols,\r
- end-startCol+1,\r
+ startCol - columnsDeleted,\r
+ end - startCol +1,\r
gapChar,\r
false);\r
+\r
+ columnsDeleted += (end - startCol +1);\r
}\r
\r
+\r
performEdit(0);\r
}\r
\r
+ public int getSize()\r
+ {\r
+ //We're interested in the number of columns deleted,\r
+ //Not the number of sequence edits.\r
+ return columnsDeleted;\r
+ }\r
+\r
}\r
\r
Vector deletedHiddenColumns;\r
\r
+ int columnsDeleted;\r
+\r
public TrimRegionCommand(String description,\r
String command,\r
SequenceI[] seqs,\r
this.colSel = colSel;\r
if (command.equalsIgnoreCase(TRIM_LEFT))\r
{\r
+ if(column==0)\r
+ return;\r
+\r
+ columnsDeleted = column;\r
+\r
edits = new Edit[] { new Edit(CUT, seqs, 0, column, al)};\r
}\r
else if (command.equalsIgnoreCase(TRIM_RIGHT))\r
{\r
+ int width = al.getWidth()-column;\r
+ if(width<2)\r
+ {\r
+ return;\r
+ }\r
+\r
+ columnsDeleted = width-1;\r
+\r
edits = new Edit[]\r
- { new Edit(CUT, seqs, column+1, al.getWidth() - column, al)};\r
+ { new Edit(CUT, seqs, column+1, width, al)};\r
}\r
\r
//We need to keep a record of the sequence start\r
colSel.hideColumns(region[0], region[1]);\r
}\r
}\r
+ }\r
\r
-\r
+ public int getSize()\r
+ {\r
+ return columnsDeleted;\r
}\r
\r
}\r