X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fcommands%2FTrimRegionCommand.java;fp=src%2Fjalview%2Fcommands%2FTrimRegionCommand.java;h=4c1dea0f26420edc314b79792864768bcfb356f0;hb=7bc226b58110fa26d9dbd3f0c78095d06909ffc3;hp=37518bcadb09f4d25e76ee7c28ae3345267abbef;hpb=dd74fc4938723fe5ec48d4e5fdcfbe58ac42a48d;p=jalview.git diff --git a/src/jalview/commands/TrimRegionCommand.java b/src/jalview/commands/TrimRegionCommand.java index 37518bc..4c1dea0 100644 --- a/src/jalview/commands/TrimRegionCommand.java +++ b/src/jalview/commands/TrimRegionCommand.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -18,9 +18,10 @@ */ package jalview.commands; -import jalview.util.ShiftList; +import java.util.*; + import jalview.datamodel.*; -import java.util.Vector; +import jalview.util.*; public class TrimRegionCommand extends EditCommand @@ -30,7 +31,7 @@ public class TrimRegionCommand public ColumnSelection colSel = null; - int [] start; + int[] start; ShiftList shiftList; @@ -41,45 +42,52 @@ public class TrimRegionCommand int columnsDeleted; public TrimRegionCommand(String description, - String command, - SequenceI[] seqs, - int column, - AlignmentI al, - ColumnSelection colSel, - SequenceGroup selectedRegion) + String command, + SequenceI[] seqs, + int column, + AlignmentI al, + ColumnSelection colSel, + SequenceGroup selectedRegion) { this.description = description; this.selectionGroup = selectedRegion; this.colSel = colSel; if (command.equalsIgnoreCase(TRIM_LEFT)) { - if(column==0) + if (column == 0) + { return; + } columnsDeleted = column; - edits = new Edit[] { new Edit(CUT, seqs, 0, column, al)}; + edits = new Edit[] + { + new Edit(CUT, seqs, 0, column, al)}; } else if (command.equalsIgnoreCase(TRIM_RIGHT)) { - int width = al.getWidth()-column-1; - if(width<2) + int width = al.getWidth() - column - 1; + if (width < 2) { return; } - columnsDeleted = width-1; + columnsDeleted = width - 1; edits = new Edit[] - { new Edit(CUT, seqs, column+1, width, al)}; + { + new Edit(CUT, seqs, column + 1, width, al)}; } //We need to keep a record of the sequence start //in order to restore the state after a redo int i, isize = edits[0].seqs.length; start = new int[isize]; - for(i=0; i