LCSclass | misc.t[2243] |
Superclass Tree | Subclass Tree | Global Objects | Property Summary | Method Summary | Property Details | Method Details |
The LCS is most frequently used as a differencing tool, to compute a description of how two data sets differ. This is at the core of tools like "diff", which shows the differences between two versions of a file. The LCS is the part of the two sets that's the same, so everything in one of the sets that's not in the LCS is unique to that set. The standard diff algorithm computes the LCS, then generates a list of edits by specifying a "delete" operation on each item in the "new" set that's not in the LCS, and an "insert" operation on each item in the "old" set that's not in the LCS. Merge and sort the two edit lists and you have basically the standard Unix "diff" output. (Some diff utilities make the report more readable by combining overlapping edit and insert operations into "update" operations. But it's really the same thing, of course.)
The constructor does all the work: use 'new' to create an instance of this class, providing the two lists to be compared as arguments. The resulting object contains the LCS information.
Note that you can use this class to generate a character-by-character LCS for two strings, simply by using toUnicode() to convert each string to a list of character values.
class
LCS : object
lcsA | misc.t[2308] |
lcsB | misc.t[2309] |
construct (a, b) | misc.t[2244] |