ExtendedDiff
public struct ExtendedDiff : DiffProtocol
A sequence of deletions, insertions, and moves where deletions point to locations in the source and insertions point to locations in the output. Examples:
"12" -> "": D(0)D(1)
"" -> "12": I(0)I(1)
See also
Diff-
Declaration
Swift
public typealias Index = Int
-
Declaration
Swift
public enum Element
-
Returns the position immediately after the given index.
Declaration
Swift
public func index(after i: Int) -> Int
Parameters
i
A valid index of the collection.
i
must be less thanendIndex
.Return Value
The index value immediately after
i
. -
Diff used to compute an instance
Declaration
Swift
public let source: Diff
-
An array of particular diff operations
Declaration
Swift
public let elements: [ExtendedDiff.Element]
-
Generates a patch sequence based on the callee. It is a list of steps to be applied to obtain the
to
collection from thefrom
one. The sorting function lets you sort the output e.g. you might want the output patch to have insertions first.Complexity
O(D^2)
Declaration
Swift
public func patch<T: Collection>( from: T, to: T, sort: OrderedBefore? = nil ) -> [ExtendedPatch<T.Element>]
Parameters
from
The source collection (usually the source collecetion of the callee)
to
The target collection (usually the target collecetion of the callee)
sort
A sorting function
Return Value
Arbitrarly sorted sequence of steps to obtain
to
collection from thefrom
one.