LCSclassmisc.t[2243]

LCS - class that computes the Longest Common Subsequence for two lists or vectors.

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

Superclass Tree   (in declaration order)

LCS
        object

Subclass Tree  

(none)

Global Objects  

(none)

Summary of Properties  

lcsA  lcsB 

Summary of Methods  

construct 

Properties  

lcsAmisc.t[2308]

the LCS, as lists of character indices into the respective strings

lcsBmisc.t[2309]
no description available

Methods  

construct (a, b)misc.t[2244]

no description available

Adv3Lite Library Reference Manual
Generated on 25/04/2024 from adv3Lite version 2.0