}
}
+ /**
+ * Answers a (possibly empty) iterable list of those annotations in the supplied
+ * list whose reference sequence, calcId or label matches the supplied
+ * parameters. Null parameter values are ignored.
+ *
+ * @param list
+ * @param seq
+ * @param calcId
+ * @param label
+ * @return
+ */
public static Iterable<AlignmentAnnotation> findAnnotations(
Iterable<AlignmentAnnotation> list, SequenceI seq, String calcId,
String label)
{
-
- ArrayList<AlignmentAnnotation> aa = new ArrayList<>();
+ List<AlignmentAnnotation> aa = new ArrayList<>();
for (AlignmentAnnotation ann : list)
{
- 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))))
+ if ((calcId == null || calcId.equals(ann.getCalcId()))
+ && (seq == null || seq == ann.sequenceRef)
+ && (label == null || label.equals(ann.label)))
{
aa.add(ann);
}
return false;
}
+ /**
+ * Returns a (possibly empty) iterable set of annotations in the given list
+ * whose calcId matches the given value (which may not be null)
+ *
+ * @param list
+ * @param calcId
+ * @return
+ */
public static Iterable<AlignmentAnnotation> findAnnotation(
List<AlignmentAnnotation> list, String calcId)
{