private int GetReverseDPaths(SubArray <T> subArrayA, SubArray <T> subArrayB, int d, int k, int delta) { DiagonalVector vector = this.vectorReverse; int p = k + delta; int x; if ((k == -d) || (k != d && vector[p + 1] <= vector[p - 1])) { x = vector[p + 1] - 1; } else { x = vector[p - 1]; } int y = x - p; while (x > 0 && y > 0 && subArrayA[x].CompareTo(subArrayB[y]) == 0) { x--; y--; } vector[p] = x; return(x); }
private int GetForwardDPaths(SubArray <T> subArrayA, SubArray <T> subArrayB, int d, int k) { DiagonalVector vector = this.vectorForward; int x; if ((k == -d) || (k != d && vector[k - 1] < vector[k + 1])) { x = vector[k + 1]; } else { x = vector[k - 1] + 1; } int y = x - k; while (x < subArrayA.Length && y < subArrayB.Length && subArrayA[x + 1].CompareTo(subArrayB[y + 1]) == 0) { x++; y++; } vector[k] = x; return(x); }
public MyersDiff(IList <T> listA, IList <T> listB, bool supportChangeEditType) { this.listA = listA; this.listB = listB; this.supportChangeEditType = supportChangeEditType; int n = listA.Count; int m = listB.Count; this.vectorForward = new DiagonalVector(n, m); this.vectorReverse = new DiagonalVector(n, m); }