X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fappletgui%2FColumnSelection.java;h=33c460466cb9c18c21594431212050808bbf43f7;hb=a6cd54c46366acd8bc3350a79374b18f9eb0b240;hp=cb83c4a142e1000479135b4e6b2d216826552969;hpb=99c58ee0ae2a848f982552e53feaf6d5cb9925e5;p=jalview.git diff --git a/src/jalview/appletgui/ColumnSelection.java b/src/jalview/appletgui/ColumnSelection.java index cb83c4a..33c4604 100755 --- a/src/jalview/appletgui/ColumnSelection.java +++ b/src/jalview/appletgui/ColumnSelection.java @@ -1,21 +1,21 @@ /* -* Jalview - A Sequence Alignment Editor and Viewer -* Copyright (C) 2005 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 -*/ + * Jalview - A Sequence Alignment Editor and Viewer + * Copyright (C) 2005 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.appletgui; @@ -24,70 +24,101 @@ import java.util.*; /** * NOTE: Columns are zero based. */ -public class ColumnSelection{ +public class ColumnSelection +{ Vector selected = new Vector(); - public void addElement(int col) { - selected.addElement(new Integer(col)); + public void addElement(int col) + { + if(!selected.contains(new Integer(col))) + selected.addElement(new Integer(col)); } - public void clear() { + public void clear() + { selected.removeAllElements(); } - public void removeElement(int col) { + public void removeElement(int col) + { Integer colInt = new Integer(col); - if (selected.contains(colInt)) { + if (selected.contains(colInt)) + { selected.removeElement(colInt); - } else { - System.err.println("WARNING: Tried to remove Integer NOT in ColumnSelection"); } } - public boolean contains(int col) { + public void removeElements(int start, int end) + { + Integer colInt; + for(int i=start; i max) { + for (int i = 0; i < selected.size(); i++) + { + if (columnAt(i) > max) + { max = columnAt(i); } } return max; } - public int getMin() { + public int getMin() + { int min = 1000000000; - for (int i=0;i= start) - selected.setElementAt(new Integer(temp-change),i); + { + selected.setElementAt(new Integer(temp - change), i); + } } } }