The result of running Myers' diff algorithm against two IndexedSeq instances. Provides the basic deletes and inserts operations required to transform base into target as well as higher-level logic that refines the basic result (like detecting "move" and "replace" ops).
The result of running Myers' diff algorithm against two IndexedSeq instances. Provides the basic deletes and inserts operations required to transform base into target as well as higher-level logic that refines the basic result (like detecting "move" and "replace" ops).
Instances are created with Diff(base, target)
.
- Companion
- object
Value members
Abstract methods
Identifies all operation types (Diff.Op.Delete, Diff.Op.Insert, Diff.Op.Move and Diff.Op.Replace)
and returns them sorted by baseIx
.
Identifies all operation types (Diff.Op.Delete, Diff.Op.Insert, Diff.Op.Move and Diff.Op.Replace)
and returns them sorted by baseIx
.
The difference to delInsMovOpsSorted is that deletes and inserts targeting the same baseIx
are combined into
Diff.Op.Replace instances.
Creates a bidirectional index mapping between base and target, without taking moves into account. This means that elements that have been moved will not have their indices mapped. They simply appear as "not present" in the other sequence.
Creates a bidirectional index mapping between base and target, without taking moves into account. This means that elements that have been moved will not have their indices mapped. They simply appear as "not present" in the other sequence.
The benefit over bimap is the reduced overhead since the O(N^^2) move detection doesn't have to be performed.
Segments the inputs into a sequence of chunks representing the diff in a alternative form, that is sometimes better suited to the task at hand than allOps and friends.
Segments the inputs into a sequence of chunks representing the diff in a alternative form, that is sometimes better suited to the task at hand than allOps and friends.
Returns an optimal number of the Diff.Op.DelInsMov operations required to transform base into target. Spends an additional O(N^^2) time on finding Diff.Op.Move operations.
Returns an optimal number of the Diff.Op.DelInsMov operations required to transform base into target. Spends an additional O(N^^2) time on finding Diff.Op.Move operations.
Note that a move is only identified as such if a Diff.Op.Delete has a directly corresponding Diff.Op.Insert. There is no further search for moves in subsets of individual deletes or inserts. Or said differently: Deletes and Inserts are never split to identify potential moves between parts of them.
The Diff.Op.Delete operations that, together with inserts, are required to transform base into target.
The Diff.Op.Delete operations that, together with inserts, are required to transform base into target.
The Diff.Op.Insert operations that, together with deletes, are required to transform base into target.
The Diff.Op.Insert operations that, together with deletes, are required to transform base into target.
Returns a longest common subsequence of the base
and target
sequences.
or None, if the two sequences have no elements in common.
Stacksafe and reasonably efficient.
Returns a longest common subsequence of the base
and target
sequences.
or None, if the two sequences have no elements in common.
Stacksafe and reasonably efficient.
NOTE: If you only need the longestCommonSubsequence
then directly calling
Diff.longestCommonSubsequence(base, target)
is more efficient than
Diff(base, target).longestCommonSubsequence
!
Returns the minimum number of edits required to transform base
and target
,
whereby one "edit" corresponds to deleting or inserting one single element.
Returns the minimum number of edits required to transform base
and target
,
whereby one "edit" corresponds to deleting or inserting one single element.
Same as delInsOps.map(_.count).sum
but slightly more efficient.
NOTE: If you only need the minEditDistance
then directly calling Diff.minEditDistance(base, target)
is more efficient than Diff(base, target).minEditDistance
!
Identifies move operations and packages the diff data into a Diff.Patch instances,
which contains all information required to produce the target
sequence when only the base
sequence is given.
Identifies move operations and packages the diff data into a Diff.Patch instances,
which contains all information required to produce the target
sequence when only the base
sequence is given.