eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Diff':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: Diff


Inheritance:

   Object
   |
   +--Diff

Package:
stx:libtool
Category:
Collections-Support
Version:
rev: 1.6 date: 2017/05/16 12:19:31
user: mawalch
file: Diff.st directory: libtool
module: stx stc-classLibrary: libtool
Author:
Jakub Zelenka (zelenj7@fel.cvut.cz)
Vladislav Skoumal (skoumal@skoumal.net)
Jan Vrany (jan.vrany@fit.cvut.cz)

Description:


I'm standard diff implementation written purely in Smalltalk. I can
compute differences between two sequenceable collections, not necessarily
holding strings. Elements are compared using #=.

Result of comparison is an edit script, a linked list of Diff::Changes,
each keeping one difference: whether change is insert and/or delete,
and positions in A and B.

I'm a port of Java diff.


[instance variables:]

[class variables:]


Related information:



Class protocol:

diffing
o  between: a and: b

o  between: a and: b reverse: reverse

instance creation
o  new
return an initialized instance


Instance protocol:

diffing
o  a: gA b: gB
Prepare to find differences between two arrays. Each element of
the arrays is translated to an

o  diff

o  diff: reverse

o  diffUsingScript: bld
Get the results of comparison as an edit script. The script
is described by a list of changes. The standard ScriptBuilder
implementations provide for forward and reverse edit scripts.
Alternate implementations could, for instance, list common elements
instead of differences.
@param bld an object to build the script from change flags
@return the head of a list of changes
Some lines are obviously insertions or deletions
because they don't match anything. Detect them now,
and avoid even thinking about them in the main comparison algorithm.

initialization
o  initialize
konstruktor

private
o  compareseq: gXoff xlim: gXlim yoff: gYoff ylim: gYlim
Compare in detail contiguous subsequences of the two files
which are known, as a whole, to match each other.

The results are recorded in the vectors filevec[N].changedflag, by
storing a 1 in the element for each line that is an insertion or deletion.

The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1.

Note that XLIM, YLIM are exclusive bounds.
All line numbers are origin-0 and discarded lines are not counted.

o  diag: anXoff xlim: anXlim yoff: aYoff ylim: aYlim
Give the compiler a chance.

o  discardConfusingLines
Discard lines from one file that have no matches in the other file.

o  equivMax

o  equivMax: something

o  filevec

o  nodiscards

o  nodiscards: something

o  shiftBoundaries
Adjust inserts/deletes of blank lines to join changes
as much as possible.


Private classes:

    Change
    Data
    ForwardScript
    ReverseScript


ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Sun, 22 Jul 2018 06:44:49 GMT