X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2Ffeatures%2FSequenceFeatures.java;h=db2f0e1bb9950587e78519087fc8232151d57425;hb=bc07c82cde95d498cf6919422baf7ad3994e1bf2;hp=539097589e48276ffacd2b949d5f8516b3eaec85;hpb=daae26d77ca41f38972dfcada536e95bdfb5c753;p=jalview.git diff --git a/src/jalview/datamodel/features/SequenceFeatures.java b/src/jalview/datamodel/features/SequenceFeatures.java index 5390975..db2f0e1 100644 --- a/src/jalview/datamodel/features/SequenceFeatures.java +++ b/src/jalview/datamodel/features/SequenceFeatures.java @@ -25,7 +25,6 @@ import jalview.io.gff.SequenceOntologyFactory; import jalview.io.gff.SequenceOntologyI; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -204,7 +203,9 @@ public class SequenceFeatures implements SequenceFeaturesI /** * A convenience method that converts a vararg for feature types to an - * Iterable over matched feature sets in key order + * Iterable over matched feature sets. If no types are specified, all feature + * sets are returned. If one or more types are specified, feature sets for + * those types are returned, preserving the order of the types. * * @param type * @return @@ -220,12 +221,11 @@ public class SequenceFeatures implements SequenceFeaturesI } List types = new ArrayList<>(); - List args = Arrays.asList(type); - for (Entry featureType : featureStore.entrySet()) + for (String theType : type) { - if (args.contains(featureType.getKey())) + if (theType != null && featureStore.containsKey(theType)) { - types.add(featureType.getValue()); + types.add(featureStore.get(theType)); } } return types; @@ -447,13 +447,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; } -} \ No newline at end of file + + /** + * {@inheritDoc} + */ + @Override + public void deleteAll() + { + featureStore.clear(); + } +}