Merge remote-tracking branch 'origin/develop' into
[jalview.git] / src / jalview / datamodel / Alignment.java
index cff3890..fcb6109 100755 (executable)
@@ -1644,10 +1644,6 @@ public class Alignment implements AlignmentI
     return aa;
   }
 
-  /**
-   * Returns an iterable collection of any annotations that match on given
-   * sequence ref, calcId and label (ignoring null values).
-   */
   @Override
   public Iterable<AlignmentAnnotation> findAnnotations(SequenceI seq,
           String calcId, String label)
@@ -1655,9 +1651,11 @@ public class Alignment implements AlignmentI
     ArrayList<AlignmentAnnotation> aa = new ArrayList<AlignmentAnnotation>();
     for (AlignmentAnnotation ann : getAlignmentAnnotation())
     {
-      if (ann.getCalcId() != null && ann.getCalcId().equals(calcId)
-              && ann.sequenceRef != null && ann.sequenceRef == seq
-              && ann.label != null && ann.label.equals(label))
+      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))))
       {
         aa.add(ann);
       }