* Builds a transformed delta from an applied delta and its transformed ops.
*/
public static TransformedWaveletDelta buildTransformedDelta(
ByteStringMessage<ProtocolAppliedWaveletDelta> appliedDeltaBytes, WaveletDelta transformed)
throws InvalidProtocolBufferException {
ProtocolAppliedWaveletDelta appliedDelta = appliedDeltaBytes.getMessage();
Preconditions.checkArgument(
getHashedVersionAppliedAt(appliedDeltaBytes).equals(transformed.getTargetVersion()));
Preconditions.checkArgument(appliedDelta.getOperationsApplied() == transformed.size());
HashedVersion resultingVersion = HASH_FACTORY.create(appliedDeltaBytes.getByteArray(),
transformed.getTargetVersion(), appliedDelta.getOperationsApplied());
return TransformedWaveletDelta.cloneOperations(resultingVersion,
appliedDelta.getApplicationTimestamp(), transformed);
}