JAL-819 menu options to reinstate missing auto-calculated annotation
[jalview.git] / src / jalview / datamodel / AlignmentAnnotation.java
index 2ee4503..a898746 100755 (executable)
@@ -1647,20 +1647,27 @@ public class AlignmentAnnotation
     }
   }
 
+  /**
+   * Answers a (possibly empty) iterable list of those annotations in the supplied
+   * list whose reference sequence, calcId or label matches the supplied
+   * parameters. Null parameter values are ignored.
+   * 
+   * @param list
+   * @param seq
+   * @param calcId
+   * @param label
+   * @return
+   */
   public static Iterable<AlignmentAnnotation> findAnnotations(
           Iterable<AlignmentAnnotation> list, SequenceI seq, String calcId,
           String label)
   {
-
-    ArrayList<AlignmentAnnotation> aa = new ArrayList<>();
+    List<AlignmentAnnotation> aa = new ArrayList<>();
     for (AlignmentAnnotation ann : list)
     {
-      if ((calcId == null || (ann.getCalcId() != null
-              && ann.getCalcId().equals(calcId)))
-              && (seq == null || (ann.sequenceRef != null
-                      && ann.sequenceRef == seq))
-              && (label == null
-                      || (ann.label != null && ann.label.equals(label))))
+      if ((calcId == null || calcId.equals(ann.getCalcId()))
+              && (seq == null || seq == ann.sequenceRef)
+              && (label == null || label.equals(ann.label)))
       {
         aa.add(ann);
       }
@@ -1693,6 +1700,14 @@ public class AlignmentAnnotation
     return false;
   }
 
+  /**
+   * Returns a (possibly empty) iterable set of annotations in the given list
+   * whose calcId matches the given value (which may not be null)
+   * 
+   * @param list
+   * @param calcId
+   * @return
+   */
   public static Iterable<AlignmentAnnotation> findAnnotation(
           List<AlignmentAnnotation> list, String calcId)
   {