From 714c122e48957117de140264e762f48a4aeb96fc Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 15 Jun 2005 15:02:30 +0000 Subject: [PATCH] add/remove updated --- src/jalview/appletgui/ColumnSelection.java | 8 ++------ src/jalview/gui/ColumnSelection.java | 9 ++------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/jalview/appletgui/ColumnSelection.java b/src/jalview/appletgui/ColumnSelection.java index 72bec07..d6a4ba8 100755 --- a/src/jalview/appletgui/ColumnSelection.java +++ b/src/jalview/appletgui/ColumnSelection.java @@ -30,7 +30,8 @@ public class ColumnSelection public void addElement(int col) { - selected.addElement(new Integer(col)); + if(!selected.contains(new Integer(col))) + selected.addElement(new Integer(col)); } public void clear() @@ -45,11 +46,6 @@ public class ColumnSelection { selected.removeElement(colInt); } - else - { - System.err.println( - "WARNING: Tried to remove Integer NOT in ColumnSelection"); - } } public boolean contains(int col) diff --git a/src/jalview/gui/ColumnSelection.java b/src/jalview/gui/ColumnSelection.java index fc11698..2116d50 100755 --- a/src/jalview/gui/ColumnSelection.java +++ b/src/jalview/gui/ColumnSelection.java @@ -29,7 +29,8 @@ public class ColumnSelection public void addElement(int col) { - selected.addElement(new Integer(col)); + if(!selected.contains(new Integer(col))) + selected.addElement(new Integer(col)); } public void clear() @@ -40,16 +41,10 @@ public class ColumnSelection public void removeElement(int col) { Integer colInt = new Integer(col); - if (selected.contains(colInt)) { selected.removeElement(colInt); } - else - { - System.err.println( - "WARNING: Tried to remove Integer NOT in ColumnSelection"); - } } public boolean contains(int col) -- 1.7.10.2