@Override
public StatementGroup convert(XBELStatementGroup source) {
if (source == null) return null;
// Destination type
StatementGroup dest = new StatementGroup();
XBELAnnotationGroup annotationGroup = source.getAnnotationGroup();
AnnotationGroupConverter agConverter = new AnnotationGroupConverter();
// Defer to AnnotationGroupConverter
AnnotationGroup ag = agConverter.convert(annotationGroup);
dest.setAnnotationGroup(ag);
String name = source.getName();
dest.setName(name);
String comment = source.getComment();
dest.setComment(comment);
List<XBELStatement> xstatements = source.getStatement();
int size = xstatements.size();
List<Statement> statements = new ArrayList<Statement>(size);
StatementConverter sConverter = new StatementConverter();
for (final XBELStatement xstmt : xstatements) {
// Defer to StatementConverter
statements.add(sConverter.convert(xstmt));
}
dest.setStatements(statements);
List<XBELStatementGroup> xstmtGroup = source.getStatementGroup();
size = xstmtGroup.size();
List<StatementGroup> stmtGroup = new ArrayList<StatementGroup>(size);
for (final XBELStatementGroup xsg : xstmtGroup) {
stmtGroup.add(convert(xsg));
}
dest.setStatementGroups(stmtGroup);
return dest;
}