JAL-2483 use SequenceFeatures to look up groups, types, feature lengths
[jalview.git] / src / jalview / datamodel / features / SequenceFeaturesI.java
index 5f904da..43e9448 100644 (file)
@@ -16,7 +16,7 @@ public interface SequenceFeaturesI
    * 
    * @param sf
    */
-  public abstract boolean add(SequenceFeature sf);
+  abstract boolean add(SequenceFeature sf);
 
   /**
    * Returns a (possibly empty) list of features, optionally restricted to
@@ -28,7 +28,7 @@ public interface SequenceFeaturesI
    * @param type
    * @return
    */
-  public abstract List<SequenceFeature> findFeatures(int from, int to,
+  abstract List<SequenceFeature> findFeatures(int from, int to,
           String... type);
 
   /**
@@ -38,9 +38,26 @@ public interface SequenceFeaturesI
    * @param type
    * @return
    */
-  public abstract List<SequenceFeature> getAllFeatures(String... type);
+  abstract List<SequenceFeature> getAllFeatures(String... type);
 
-  public abstract int getFeatureCount(boolean positional, String... type);
+  /**
+   * Answers the number of (positional or non-positional) features, optionally
+   * restricted to specified feature types. Contact features are counted as 1.
+   * 
+   * @param positional
+   * @param type
+   * @return
+   */
+  abstract int getFeatureCount(boolean positional, String... type);
+
+  /**
+   * Answers the total length of positional features, optionally restricted to
+   * specified feature types. Contact features are counted as length 1.
+   * 
+   * @param type
+   * @return
+   */
+  abstract int getTotalFeatureLength(String... type);
 
   /**
    * Answers a list of all positional features, optionally restricted to
@@ -49,7 +66,7 @@ public interface SequenceFeaturesI
    * @param type
    * @return
    */
-  public abstract List<SequenceFeature> getPositionalFeatures(
+  abstract List<SequenceFeature> getPositionalFeatures(
           String... type);
 
   /**
@@ -58,7 +75,7 @@ public interface SequenceFeaturesI
    * 
    * @return
    */
-  public abstract List<SequenceFeature> getContactFeatures(String... type);
+  abstract List<SequenceFeature> getContactFeatures(String... type);
 
   /**
    * Answers a list of all non-positional features, optionally restricted to
@@ -68,7 +85,7 @@ public interface SequenceFeaturesI
    *          if no type is specified, all are returned
    * @return
    */
-  public abstract List<SequenceFeature> getNonPositionalFeatures(
+  abstract List<SequenceFeature> getNonPositionalFeatures(
           String... type);
 
   /**
@@ -79,14 +96,14 @@ public interface SequenceFeaturesI
    * 
    * @param sf
    */
-  public abstract boolean delete(SequenceFeature sf);
+  abstract boolean delete(SequenceFeature sf);
 
   /**
    * Answers true if this store contains at least one feature, else false
    * 
    * @return
    */
-  public abstract boolean hasFeatures();
+  abstract boolean hasFeatures();
 
   /**
    * Returns a set of the distinct feature groups present in the collection. The
@@ -99,7 +116,7 @@ public interface SequenceFeaturesI
    * @param type
    * @return
    */
-  public abstract Set<String> getFeatureGroups(boolean positionalFeatures,
+  abstract Set<String> getFeatureGroups(boolean positionalFeatures,
           String... type);
 
   /**
@@ -112,7 +129,7 @@ public interface SequenceFeaturesI
    * @param groups
    * @return
    */
-  public abstract Set<String> getFeatureTypesForGroups(
+  abstract Set<String> getFeatureTypesForGroups(
           boolean positionalFeatures, String... groups);
 
   /**
@@ -120,6 +137,6 @@ public interface SequenceFeaturesI
    * 
    * @return
    */
-  public abstract Set<String> getFeatureTypes();
+  abstract Set<String> getFeatureTypes();
 
 }
\ No newline at end of file