public XBELAnnotationGroup convert(AnnotationGroup source) {
if (source == null) return null;
List<Annotation> annotations = source.getAnnotations();
Citation citation = source.getCitation();
Evidence evidence = source.getEvidence();
XBELAnnotationGroup xag = new XBELAnnotationGroup();
List<Object> list = xag.getAnnotationOrEvidenceOrCitation();
if (hasItems(annotations)) {
// Defer to AnnotationConverter
AnnotationConverter aConverter = new AnnotationConverter();
for (final Annotation a : annotations) {
XBELAnnotation xa = aConverter.convert(a);
list.add(xa);
}
}
if (citation != null) {
// Defer to CitationConverter
CitationConverter cConverter = new CitationConverter();
XBELCitation xc = cConverter.convert(citation);
list.add(xc);
}
if (evidence != null) {
list.add(evidence.getValue());
}
return xag;
}