X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2Ffeatures%2FSequenceFeatures.java;h=d1bae508ed2d6577f33c3d1823d8402bfd68cc8a;hb=7e9e238cd202a04c405adee8fa95cc68546c3ec5;hp=f263938e05e534500f616145c246cd726cb9944b;hpb=b44349fe3a5f2d70b74a1b110018a753a1036aca;p=jalview.git diff --git a/src/jalview/datamodel/features/SequenceFeatures.java b/src/jalview/datamodel/features/SequenceFeatures.java index f263938..d1bae50 100644 --- a/src/jalview/datamodel/features/SequenceFeatures.java +++ b/src/jalview/datamodel/features/SequenceFeatures.java @@ -1,5 +1,6 @@ package jalview.datamodel.features; +import jalview.datamodel.ContiguousI; import jalview.datamodel.SequenceFeature; import jalview.io.gff.SequenceOntologyFactory; import jalview.io.gff.SequenceOntologyI; @@ -62,7 +63,7 @@ public class SequenceFeatures implements SequenceFeaturesI { /* * use a TreeMap so that features are returned in alphabetical order of type - * wrap as a synchronized map for add and delete operations + * ? wrap as a synchronized map for add and delete operations */ // featureStore = Collections // .synchronizedSortedMap(new TreeMap()); @@ -70,6 +71,21 @@ public class SequenceFeatures implements SequenceFeaturesI } /** + * Constructor given a list of features + */ + public SequenceFeatures(List features) + { + this(); + if (features != null) + { + for (SequenceFeature feature : features) + { + add(feature); + } + } + } + + /** * {@inheritDoc} */ @Override @@ -466,13 +482,22 @@ public class SequenceFeatures implements SequenceFeaturesI * {@inheritDoc} */ @Override - public boolean shiftFeatures(int shift) + public boolean shiftFeatures(int fromPosition, int shiftBy) { boolean modified = false; for (FeatureStore fs : featureStore.values()) { - modified |= fs.shiftFeatures(shift); + modified |= fs.shiftFeatures(fromPosition, shiftBy); } return modified; } + + /** + * {@inheritDoc} + */ + @Override + public void deleteAll() + { + featureStore.clear(); + } } \ No newline at end of file