1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 11:02:26 +03:00

Patches have a cost.

This charges `Replace` patches at a higher cost than `Insert`/`Delete`
patches to avoid spurious replacements.
This commit is contained in:
Rob Rix 2015-10-06 17:07:16 -04:00
parent bcc3da35f9
commit 4fdbcf948f

View File

@ -16,6 +16,17 @@ public enum Patch<A>: CustomDebugStringConvertible {
}
/// The cost of a patch to the diff.
public var cost: Int {
switch self {
case .Replace:
return 2
default:
return 1
}
}
// MARK: CustomDebugStringConvertible
public var debugDescription: String {