X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequenceGroup.java;h=76ad093130eb3b2f39cf0f4239f95003e707b754;hb=refs%2Fheads%2Ffeatures%2FJAL-2465_No-mapping_Jmol-structures-loaded-via-url;hp=e37c55eb8688e50312e58c40142954da324049fd;hpb=0585c8478eccc42896dbd1a4d365ecdc913551f2;p=jalview.git diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index e37c55e..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); } @@ -1358,7 +1354,7 @@ public class SequenceGroup implements AnnotatedCollectionI AnnotatedCollectionI ref = ctx; while (ref != null) { - if (ref == this) + if (ref == this || ref.getContext() == ctx) { throw new IllegalArgumentException( "Circular reference in SequenceGroup.context");