Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

OfficeDiffResult<T>

OfficeIMO.Diff

Namespace
OfficeIMO.Diff
Assembly
OfficeIMO.Core
Source revision
ba882f6b0d07 with working tree changes
Modifiers
sealed

Edit script between two sequences produced by OfficeDiff.

Inheritance

  • object
  • OfficeDiffResult<T>

Usage

Explore 7 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 2

Type Parameters

T
Item type.

Methods

public IReadOnlyList<T?> Apply(IReadOnlyList<T?> source) #

Applies the edit script to source and returns the new sequence. Every kept and deleted item is checked against the item recorded in the script; kept positions return the recorded new item, so a comparer that ignores case or position still yields the new values.

Parameters

source System.Collections.Generic.IReadOnlyList<T?> required

Returns

IReadOnlyList<T?>

Exceptions

  • InvalidOperationException – The source does not match the old sequence this script was computed from.
public IReadOnlyList<OfficeDiffHunk> GetChangedRegions() #

Groups the edit script into changed regions: each region is a maximal run of deletions and insertions between unchanged items.

Returns

IReadOnlyList<OfficeDiffHunk>
public IReadOnlyList<T?> Revert(IReadOnlyList<T?> target) #

Reverts the edit script on target and returns the old sequence.

Parameters

target System.Collections.Generic.IReadOnlyList<T?> required

Returns

IReadOnlyList<T?>

Exceptions

  • InvalidOperationException – The target does not match the new sequence this script was computed from.

Properties

public IReadOnlyList<T?> Old { get; } #

Old sequence.

public IReadOnlyList<T?> New { get; } #

New sequence.

public IReadOnlyList<OfficeDiffEdit> Edits { get; } #

Edit runs in order. Together they cover every old item and every new item exactly once; within each changed region the deletion comes before the insertion.

public IEqualityComparer<T?> Comparer { get; } #

Comparer used to match items.

public OfficeDiffAlgorithm Algorithm { get; } #

Algorithm that produced the alignment.

public bool LimitReached { get; } #

True when a work, time or depth limit stopped the alignment early. The edit script is still complete and correct (applying it to OfficeDiffResult<T>.Old yields OfficeDiffResult<T>.New), but some unchanged items may be reported as deleted and reinserted.

public long WorkUnits { get; } #

Comparison steps spent on the alignment.

public int EqualCount { get; } #

Number of old items that are unchanged.

public int DeletedCount { get; } #

Number of old items deleted.

public int InsertedCount { get; } #

Number of new items inserted.

public int EditDistance { get; } #

Edit distance: deletions plus insertions.

public bool AreEqual { get; } #

True when the sequences are equal under OfficeDiffResult<T>.Comparer.