5f904da05349c48c470039daac65f0ea8f0d07d6
[jalview.git] / src / jalview / datamodel / features / SequenceFeaturesI.java
1 package jalview.datamodel.features;
2
3 import jalview.datamodel.SequenceFeature;
4
5 import java.util.List;
6 import java.util.Set;
7
8 public interface SequenceFeaturesI
9 {
10
11   /**
12    * Adds one sequence feature to the store, and returns true, unless the
13    * feature is already contained in the store, in which case this method
14    * returns false. Containment is determined by SequenceFeature.equals()
15    * comparison.
16    * 
17    * @param sf
18    */
19   public abstract boolean add(SequenceFeature sf);
20
21   /**
22    * Returns a (possibly empty) list of features, optionally restricted to
23    * specified types, which overlap the given (inclusive) sequence position
24    * range
25    * 
26    * @param from
27    * @param to
28    * @param type
29    * @return
30    */
31   public abstract List<SequenceFeature> findFeatures(int from, int to,
32           String... type);
33
34   /**
35    * Answers a list of all features stored, optionally restricted to specified
36    * types, in no particular guaranteed order
37    * 
38    * @param type
39    * @return
40    */
41   public abstract List<SequenceFeature> getAllFeatures(String... type);
42
43   public abstract int getFeatureCount(boolean positional, String... type);
44
45   /**
46    * Answers a list of all positional features, optionally restricted to
47    * specified types, in no particular guaranteed order
48    * 
49    * @param type
50    * @return
51    */
52   public abstract List<SequenceFeature> getPositionalFeatures(
53           String... type);
54
55   /**
56    * Answers a list of all contact features, optionally restricted to specified
57    * types, in no particular guaranteed order
58    * 
59    * @return
60    */
61   public abstract List<SequenceFeature> getContactFeatures(String... type);
62
63   /**
64    * Answers a list of all non-positional features, optionally restricted to
65    * specified types, in no particular guaranteed order
66    * 
67    * @param type
68    *          if no type is specified, all are returned
69    * @return
70    */
71   public abstract List<SequenceFeature> getNonPositionalFeatures(
72           String... type);
73
74   /**
75    * Deletes the given feature from the store, returning true if it was found
76    * (and deleted), else false. This method makes no assumption that the feature
77    * is in the 'expected' place in the store, in case it has been modified since
78    * it was added.
79    * 
80    * @param sf
81    */
82   public abstract boolean delete(SequenceFeature sf);
83
84   /**
85    * Answers true if this store contains at least one feature, else false
86    * 
87    * @return
88    */
89   public abstract boolean hasFeatures();
90
91   /**
92    * Returns a set of the distinct feature groups present in the collection. The
93    * set may include null. The boolean parameter determines whether the groups
94    * for positional or for non-positional features are returned. The optional
95    * type parameter may be used to restrict to groups for specified feature
96    * types.
97    * 
98    * @param positionalFeatures
99    * @param type
100    * @return
101    */
102   public abstract Set<String> getFeatureGroups(boolean positionalFeatures,
103           String... type);
104
105   /**
106    * Answers the set of distinct feature types for which there is at least one
107    * feature with one of the given feature group(s). The boolean parameter
108    * determines whether the groups for positional or for non-positional features
109    * are returned.
110    * 
111    * @param positionalFeatures
112    * @param groups
113    * @return
114    */
115   public abstract Set<String> getFeatureTypesForGroups(
116           boolean positionalFeatures, String... groups);
117
118   /**
119    * Answers a set of the distinct feature types for which a feature is stored
120    * 
121    * @return
122    */
123   public abstract Set<String> getFeatureTypes();
124
125 }