From 56ab3a18f36a613d943efa0edcfcee3cae248343 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 30 Oct 2006 16:30:33 +0000 Subject: [PATCH] deleteSequenceFeature --- src/jalview/datamodel/Sequence.java | 38 ++++++++++++++++++++++++++++++++++ src/jalview/datamodel/SequenceI.java | 2 ++ 2 files changed, 40 insertions(+) diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 16cf4b8..b1a1be2 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -169,6 +169,44 @@ public class Sequence implements SequenceI sequenceFeatures = temp; } + public void deleteFeature(SequenceFeature sf) + { + if(sequenceFeatures==null) + return; + + int index=0; + for (index = 0; index < sequenceFeatures.length; index++) + { + if (sequenceFeatures[index].equals(sf)) + { + break; + } + } + + + if(index==sequenceFeatures.length) + return; + + int sfLength = sequenceFeatures.length; + if(sfLength<2) + { + sequenceFeatures = null; + } + else + { + SequenceFeature[] temp = new SequenceFeature[sfLength-1]; + System.arraycopy(sequenceFeatures, 0, temp, 0, index); + + if(index