int deletionIndex = 0;
while (preservationIndex < preservationOp.size()) {
preservationOp.applyComponent(preservationIndex++, preservationTarget);
while (preservationPosition.get() > 0) {
if (deletionIndex >= deletionOp.size()) {
throw new TransformException("Ran out of " + deletionOp.size()
+ " deletion op components after " + preservationIndex + " of "
+ preservationOp.size() + " preservation op components, with "
+ preservationPosition.get() + " spare positions");
}
deletionOp.applyComponent(deletionIndex++, deletionTarget);
}
}
while (deletionIndex < deletionOp.size()) {
deletionOp.applyComponent(deletionIndex++, deletionTarget);
}
preservationOp = preservationTarget.finish();
transformedDeletionOp = deletionTarget.finish();
} catch (InternalTransformException e) {
throw new TransformException(e.getMessage());
}
return new Pair<DocOp, Pair<DocOp, DocOp>>(preservationOp,
transformedDeletionOp);
}