From f01d759960fc7bf6d91307aac03c41870c9a5493 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 27 Apr 2017 16:34:03 +0100 Subject: [PATCH] JAL-2494 fix: updated behaviour for SequenceGroup.findAnnotations --- src/jalview/datamodel/SequenceGroup.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) 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); } -- 1.7.10.2