From dfa35cc477b0d3af4a3cd25472cb6126626c67d3 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 14 Nov 2016 12:28:57 +0000 Subject: [PATCH] JAL-2296 report whether SequenceFeature actually added to sequence --- src/jalview/datamodel/Sequence.java | 8 ++++---- src/jalview/datamodel/SequenceI.java | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index c8b94ce..b0faf21 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -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 diff --git a/src/jalview/datamodel/SequenceI.java b/src/jalview/datamodel/SequenceI.java index aec68ab..92f797f 100755 --- a/src/jalview/datamodel/SequenceI.java +++ b/src/jalview/datamodel/SequenceI.java @@ -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); -- 1.7.10.2