compose method
Composes this delta with other
and returns new Delta.
It is not required for this and other
delta to represent a document
delta (consisting only of insert operations).
Implementation
Delta compose(Delta other) {
final Delta result = new Delta();
DeltaIterator thisIter = new DeltaIterator(this);
DeltaIterator otherIter = new DeltaIterator(other);
while (thisIter.hasNext || otherIter.hasNext) {
final Operation? newOp = _composeOperation(thisIter, otherIter);
if (newOp != null) result.push(newOp);
}
return result..trim();
}