X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FColumnSelection.java;h=9ec4270c8830bba64486111cbca941963ab058d6;hb=49685e6426d5ac136dce4907196751680c667670;hp=6b448320f0aa225a53a266ab9f75bfec1203163c;hpb=d4f6172fff9d39d2cf3bd1a8d0260521615a5993;p=jalview.git diff --git a/src/jalview/datamodel/ColumnSelection.java b/src/jalview/datamodel/ColumnSelection.java index 6b44832..9ec4270 100644 --- a/src/jalview/datamodel/ColumnSelection.java +++ b/src/jalview/datamodel/ColumnSelection.java @@ -1,27 +1,27 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 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 * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ package jalview.datamodel; -import jalview.util.ShiftList; - import java.util.*; +import jalview.util.*; + /** * NOTE: Columns are zero based. */ @@ -77,7 +77,7 @@ public class ColumnSelection public void removeElements(int start, int end) { Integer colInt; - for(int i=start; istart && start+change>region[1] ) + if (region[0] > start && start + change > region[1]) { deletedHiddenColumns.addElement( hiddenColumns.elementAt(i)); @@ -206,14 +206,16 @@ public class ColumnSelection continue; } - if(region[0]>start) + if (region[0] > start) { region[0] -= change; region[1] -= change; } - if(region[0]<0) + if (region[0] < 0) + { region[0] = 0; + } } @@ -222,6 +224,7 @@ public class ColumnSelection return deletedHiddenColumns; } + /** * propagate shift in alignment columns to column selection * special version of compensateForEdit - allowing for edits within hidden regions @@ -240,51 +243,63 @@ public class ColumnSelection } } - if(hiddenColumns!=null) + if (hiddenColumns != null) { - for(int i=0; i= start) + if (region[0] >= start) { region[0] -= change; } - if (region[1]>= start) { - region[1] -=change; + if (region[1] >= start) + { + region[1] -= change; } - if (region[1]