+
+ private AnnotatedCollectionI context;
+
+ /**
+ * set the alignment or group context for this group
+ *
+ * @param context
+ */
+ public void setContext(AnnotatedCollectionI context)
+ {
+ this.context = context;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.datamodel.AnnotatedCollectionI#getContext()
+ */
+ @Override
+ public AnnotatedCollectionI getContext()
+ {
+ return context;
+ }
+
+ @Override
+ public Iterable<AlignmentAnnotation> findAnnotation(
+ SequenceI datasequence, String calcId, String label)
+ {
+ List<AlignmentAnnotation> result = new ArrayList<AlignmentAnnotation>();
+ for (AlignmentAnnotation ann : getAlignmentAnnotation())
+ {
+ // only sequence-linked annotations can qualify (have a datasequence)
+ if (ann.sequenceRef == null)
+ {
+ continue;
+ }
+ boolean matchDatasequence = (ann.sequenceRef.getDatasetSequence() == datasequence);
+ final String annCalcId = ann.getCalcId();
+ boolean matchCalcId = (annCalcId != null && annCalcId.equals(calcId));
+ boolean matchLabel = (ann.label != null && ann.label.equals(label));
+ if (matchDatasequence && matchCalcId && matchLabel)
+ {
+ result.add(ann);
+ }
+ }
+ return result;
+ }