public static DocOp deserialize(ProtocolDocumentOperation op) {
DocOpBuilder output = new DocOpBuilder();
for (ProtocolDocumentOperation.Component c : op.getComponent()) {
if (c.hasAnnotationBoundary()) {
AnnotationBoundary boundary = c.getAnnotationBoundary();
if (boundary.getEmpty()) {
output.annotationBoundary(AnnotationBoundaryMapImpl.EMPTY_MAP);
} else {
String[] ends = boundary.getEnd().toArray(new String[boundary.getEnd().size()]);
int changes = boundary.getChange().size();
String[] changeKeys = new String[changes];
String[] oldValues = new String[changes];
String[] newValues = new String[changes];
for (int i = 0; i < changes; i++) {
KeyValueUpdate kvu = boundary.getChange(i);
changeKeys[i] = kvu.getKey();
oldValues[i] = kvu.hasOldValue() ? kvu.getOldValue() : null;
newValues[i] = kvu.hasNewValue() ? kvu.getNewValue() : null;
}
output.annotationBoundary(new AnnotationBoundaryMapImpl(ends, changeKeys, oldValues,