From: Jim Procter Date: Thu, 27 Apr 2017 15:34:03 +0000 (+0100) Subject: JAL-2494 fix: updated behaviour for SequenceGroup.findAnnotations X-Git-Tag: Release_2_10_2~3^2~123^2~6 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f01d759960fc7bf6d91307aac03c41870c9a5493;p=jalview.git JAL-2494 fix: updated behaviour for SequenceGroup.findAnnotations --- diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index 1246d23..76ad093 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -1289,12 +1289,6 @@ public class SequenceGroup implements AnnotatedCollectionI return aa; } - /** - * Returns a list of annotations that match the specified sequenceRef, calcId - * and label, ignoring null values. - * - * @return list of AlignmentAnnotation objects - */ @Override public Iterable findAnnotations(SequenceI seq, String calcId, String label) @@ -1302,9 +1296,11 @@ public class SequenceGroup implements AnnotatedCollectionI ArrayList aa = new ArrayList(); 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); }