public Merge([NotNull] IList <T> commonBase, [NotNull] IList <T> left, [NotNull] IList <T> right, [NotNull] IDiffElementAligner <T> aligner, [NotNull] IMergeConflictResolver <T> conflictResolver, [NotNull] IEqualityComparer <T> comparer, [NotNull] DiffOptions diffOptions) { if (commonBase == null) { throw new ArgumentNullException(nameof(commonBase)); } if (left == null) { throw new ArgumentNullException(nameof(left)); } if (right == null) { throw new ArgumentNullException(nameof(right)); } if (aligner == null) { throw new ArgumentNullException(nameof(aligner)); } if (comparer == null) { throw new ArgumentNullException(nameof(comparer)); } if (diffOptions == null) { throw new ArgumentNullException(nameof(diffOptions)); } _ConflictResolver = conflictResolver ?? throw new ArgumentNullException(nameof(conflictResolver)); var diffCommonBaseToLeft = Diff.AlignElements(commonBase, left, Diff.CalculateSections(commonBase, left, diffOptions, comparer), aligner).ToList(); Assume.That(diffCommonBaseToLeft != null); _DiffCommonBaseToLeft = diffCommonBaseToLeft; var diffCommonBaseToRight = Diff.AlignElements(commonBase, right, Diff.CalculateSections(commonBase, right, diffOptions, comparer), aligner).ToList(); Assume.That(diffCommonBaseToRight != null); _DiffCommonBaseToRight = diffCommonBaseToRight; var mergeSections = Diff.CalculateSections(diffCommonBaseToLeft, diffCommonBaseToRight, diffOptions, new DiffSectionMergeComparer <T>(comparer)).ToList(); Assume.That(mergeSections != null); _MergeSections = mergeSections; }
public static IEnumerable <T> Perform <T>([NotNull] IList <T> commonBase, [NotNull] IList <T> left, [NotNull] IList <T> right, [CanBeNull] DiffOptions diffOptions, [NotNull] IDiffElementAligner <T> aligner, [NotNull] IMergeConflictResolver <T> conflictResolver, [CanBeNull] IEqualityComparer <T> comparer = null) { if (commonBase == null) { throw new ArgumentNullException(nameof(commonBase)); } if (left == null) { throw new ArgumentNullException(nameof(left)); } if (right == null) { throw new ArgumentNullException(nameof(right)); } if (aligner == null) { throw new ArgumentNullException(nameof(aligner)); } if (conflictResolver == null) { throw new ArgumentNullException(nameof(conflictResolver)); } diffOptions = diffOptions ?? new DiffOptions(); comparer = comparer ?? EqualityComparer <T> .Default; Assume.That(comparer != null); return(new Merge <T>(commonBase, left, right, aligner, conflictResolver, comparer, diffOptions)); }
public static IEnumerable <T> Perform <T>([NotNull] IList <T> commonBase, [NotNull] IList <T> left, [NotNull] IList <T> right, [NotNull] IDiffElementAligner <T> aligner, [NotNull] IMergeConflictResolver <T> conflictResolver, [CanBeNull] IEqualityComparer <T> comparer = null) { return(Perform(commonBase, left, right, new DiffOptions(), aligner, conflictResolver, comparer)); }