Search in sources :

Example 1 with MergeRange

use of com.intellij.diff.util.MergeRange in project intellij-community by JetBrains.

the class ByWord method compare.

@NotNull
public static List<MergeWordFragment> compare(@NotNull CharSequence text1, @NotNull CharSequence text2, @NotNull CharSequence text3, @NotNull ComparisonPolicy policy, @NotNull ProgressIndicator indicator) {
    indicator.checkCanceled();
    List<InlineChunk> words1 = getInlineChunks(text1);
    List<InlineChunk> words2 = getInlineChunks(text2);
    List<InlineChunk> words3 = getInlineChunks(text3);
    FairDiffIterable wordChanges1 = diff(words2, words1, indicator);
    wordChanges1 = optimizeWordChunks(text2, text1, words2, words1, wordChanges1, indicator);
    FairDiffIterable iterable1 = matchAdjustmentDelimiters(text2, text1, words2, words1, wordChanges1, indicator);
    FairDiffIterable wordChanges2 = diff(words2, words3, indicator);
    wordChanges2 = optimizeWordChunks(text2, text3, words2, words3, wordChanges2, indicator);
    FairDiffIterable iterable2 = matchAdjustmentDelimiters(text2, text3, words2, words3, wordChanges2, indicator);
    List<MergeRange> wordConflicts = ComparisonMergeUtil.buildFair(iterable1, iterable2, indicator);
    List<MergeRange> result = matchAdjustmentWhitespaces(text1, text2, text3, wordConflicts, policy, indicator);
    return convertIntoMergeWordFragments(result);
}
Also used : FairDiffIterable(com.intellij.diff.comparison.iterables.FairDiffIterable) MergeRange(com.intellij.diff.util.MergeRange) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

FairDiffIterable (com.intellij.diff.comparison.iterables.FairDiffIterable)1 MergeRange (com.intellij.diff.util.MergeRange)1 NotNull (org.jetbrains.annotations.NotNull)1