|
Class: MyersUkkonen (private in Diff2
This class is only visible from within
Diff2.
Object
|
+--Diff2
|
+--Diff2::MyersUkkonen
- Package:
- stx:libtool
- Category:
- Collections-Sequenceable-Diff
- Owner:
- Diff2
I implement a modified version of Myers' greedy lcs algorithm described in http://xmailserver.org/diff2.pdf.
A similar version written in C can be found here http://research.janelia.org/myers/Papers/file.comparison.pdf.
Ukkonen's version can be found here http://www.cs.helsinki.fi/u/ukkonen/InfCont85.PDF.
[instance variables:]
[class variables:]
copyrightCopyright (c) 2007-2012 Tony Garnock-Jones
This code is based on Squeak's DiffMerge package
written by Tony Garnock-Jones. Original project's web site:
http://www.squeaksource.com/DiffMerge
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
accessing
-
emptyCaches
-
diffing
-
longestCommonSubsequence
-
(comment from inherited method)
The longestCommonSubsequence (LCS) algorithm is at the heart of a diff/comm algorithm.
private
-
calculateLcs
-
I find one of the longest common subsequences of my the arguments. I assume that none of my arguments are empty. I return nil or an Array which represents a list. The first two elements are the matching line numbers, the last is the next node in the list or nil if there are no more elements. The list containts the longest common subsequence. I'm a modified version of the greedy lcs algorithm from the 6th page of 'An O(ND) Difference Algorithm and Its Variations (1986)' by Eugene W. Myers
|