JAL-2296 report whether SequenceFeature actually added to sequence
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 14 Nov 2016 12:28:57 +0000 (12:28 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 14 Nov 2016 12:28:57 +0000 (12:28 +0000)
src/jalview/datamodel/Sequence.java
src/jalview/datamodel/SequenceI.java

index c8b94ce..b0faf21 100755 (executable)
@@ -314,12 +314,11 @@ public class Sequence extends ASequence implements SequenceI
   }
 
   @Override
-  public synchronized void addSequenceFeature(SequenceFeature sf)
+  public synchronized boolean addSequenceFeature(SequenceFeature sf)
   {
     if (sequenceFeatures == null && datasetSequence != null)
     {
-      datasetSequence.addSequenceFeature(sf);
-      return;
+      return datasetSequence.addSequenceFeature(sf);
     }
     if (sequenceFeatures == null)
     {
@@ -330,7 +329,7 @@ public class Sequence extends ASequence implements SequenceI
     {
       if (sequenceFeatures[i].equals(sf))
       {
-        return;
+        return false;
       }
     }
 
@@ -339,6 +338,7 @@ public class Sequence extends ASequence implements SequenceI
     temp[sequenceFeatures.length] = sf;
 
     sequenceFeatures = temp;
+    return true;
   }
 
   @Override
index aec68ab..92f797f 100755 (executable)
@@ -337,7 +337,14 @@ public interface SequenceI extends ASequenceI
    */
   public void addDBRef(DBRefEntry entry);
 
-  public void addSequenceFeature(SequenceFeature sf);
+  /**
+   * Adds the given sequence feature and returns true, or returns false if it is
+   * already present on the sequence
+   * 
+   * @param sf
+   * @return
+   */
+  public boolean addSequenceFeature(SequenceFeature sf);
 
   public void deleteFeature(SequenceFeature sf);