private static OperationBase TransformDeleteInsert(DeleteOperation remoteDelete, InsertOperation localInsert) { if (remoteDelete.Position < localInsert.Position) { return(remoteDelete); } else { return(remoteDelete.NewWithPosition(remoteDelete.Position + localInsert.Length)); } }
private static OperationBase TransformDeleteDelete(DeleteOperation remoteDelete, DeleteOperation localDelete) { if (remoteDelete.Position < localDelete.Position) { return(remoteDelete); } else if (remoteDelete.Position > localDelete.Position) { return(remoteDelete.NewWithPosition(remoteDelete.Position - localDelete.Length)); } else { return(new IdentityOperation(remoteDelete.UserId, remoteDelete.SequenceId)); } }