JAL-2505 remove setters for SequenceFeature.begin,end,type,featureGroup
[jalview.git] / src / jalview / datamodel / SequenceFeature.java
index b61dd71..fa29ffd 100755 (executable)
@@ -178,6 +178,24 @@ public class SequenceFeature implements FeatureLocationI
   }
 
   /**
+   * A copy constructor that allows the begin and end positions and group to be
+   * modified
+   * 
+   * @param sf
+   * @param newBegin
+   * @param newEnd
+   * @param newGroup
+   */
+  public SequenceFeature(SequenceFeature sf, int newBegin, int newEnd,
+          String newGroup)
+  {
+    this(sf);
+    begin = newBegin;
+    end = newEnd;
+    featureGroup = newGroup;
+  }
+
+  /**
    * Two features are considered equal if they have the same type, group,
    * description, start, end, phase, strand, and (if present) 'Name', ID' and
    * 'Parent' attributes.
@@ -276,11 +294,6 @@ public class SequenceFeature implements FeatureLocationI
     return begin;
   }
 
-  public void setBegin(int start)
-  {
-    this.begin = start;
-  }
-
   /**
    * DOCUMENT ME!
    * 
@@ -292,11 +305,6 @@ public class SequenceFeature implements FeatureLocationI
     return end;
   }
 
-  public void setEnd(int end)
-  {
-    this.end = end;
-  }
-
   /**
    * DOCUMENT ME!
    * 
@@ -307,11 +315,6 @@ public class SequenceFeature implements FeatureLocationI
     return type;
   }
 
-  public void setType(String type)
-  {
-    this.type = type;
-  }
-
   /**
    * DOCUMENT ME!
    * 
@@ -332,11 +335,6 @@ public class SequenceFeature implements FeatureLocationI
     return featureGroup;
   }
 
-  public void setFeatureGroup(String featureGroup)
-  {
-    this.featureGroup = featureGroup;
-  }
-
   public void addLink(String labelLink)
   {
     if (links == null)
@@ -344,7 +342,10 @@ public class SequenceFeature implements FeatureLocationI
       links = new Vector<String>();
     }
 
-    links.insertElementAt(labelLink, 0);
+    if (!links.contains(labelLink))
+    {
+      links.insertElementAt(labelLink, 0);
+    }
   }
 
   public float getScore()