From: gmungoc Date: Mon, 22 May 2017 11:24:56 +0000 (+0100) Subject: JAL-2480 always include all non-positional features in getAllFeatures() X-Git-Tag: Release_2_10_3b1~256 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f782e40f6f1b3f2bb22927891493c5faf318625b;p=jalview.git JAL-2480 always include all non-positional features in getAllFeatures() --- diff --git a/src/jalview/datamodel/features/SequenceFeatures.java b/src/jalview/datamodel/features/SequenceFeatures.java index 73ddac7..af99ada 100644 --- a/src/jalview/datamodel/features/SequenceFeatures.java +++ b/src/jalview/datamodel/features/SequenceFeatures.java @@ -120,7 +120,7 @@ public class SequenceFeatures implements SequenceFeaturesI result.addAll(getPositionalFeatures(type)); - result.addAll(getNonPositionalFeatures(type)); + result.addAll(getNonPositionalFeatures()); return result; } diff --git a/src/jalview/datamodel/features/SequenceFeaturesI.java b/src/jalview/datamodel/features/SequenceFeaturesI.java index ed966e7..281743e 100644 --- a/src/jalview/datamodel/features/SequenceFeaturesI.java +++ b/src/jalview/datamodel/features/SequenceFeaturesI.java @@ -33,8 +33,12 @@ public interface SequenceFeaturesI String... type); /** - * Answers a list of all features stored, optionally restricted to specified - * types, in no particular guaranteed order + * Answers a list of all features stored, in no particular guaranteed order. + * Positional features may optionally be restricted to specified types, but + * all non-positional features (if any) are always returned. + *

+ * To filter non-positional features by type, use + * getNonPositionalFeatures(type). * * @param type * @return diff --git a/test/jalview/datamodel/features/SequenceFeaturesTest.java b/test/jalview/datamodel/features/SequenceFeaturesTest.java index 5ff2d7b..d3927fe 100644 --- a/test/jalview/datamodel/features/SequenceFeaturesTest.java +++ b/test/jalview/datamodel/features/SequenceFeaturesTest.java @@ -689,8 +689,14 @@ public class SequenceFeaturesTest features = store.getAllFeatures(); assertEquals(features.size(), 5); assertTrue(features.contains(sf5)); + + /* + * select by type does not apply to non-positional features + */ features = store.getAllFeatures("Cath"); - assertTrue(features.isEmpty()); + assertEquals(features.size(), 1); + assertTrue(features.contains(sf3)); + features = store.getAllFeatures("Pfam", "Cath", "Metal"); assertEquals(features.size(), 3); assertTrue(features.contains(sf1));