[squeak-dev] The Trunk: System-fbs.599.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Oct 1 22:19:36 UTC 2013


Frank Shearar uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-fbs.599.mcz

==================== Summary ====================

Name: System-fbs.599
Author: fbs
Time: 1 October 2013, 11:19:18.501 pm
UUID: ec7dbcc2-93e6-4143-bfee-4d52d9368951
Ancestors: System-fbs.598

Minor spelling corrections.

=============== Diff against System-fbs.598 ===============

Item was changed:
  TextDiffBuilder subclass: #ClassDiffBuilder
  	instanceVariableNames: ''
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'System-FilePackage'!
  
+ !ClassDiffBuilder commentStamp: 'fbs 9/23/2013 08:58' prior: 0!
+ I'm like TextDiffBuilder, but I split the input text by Character >> #separators, instead of new lines. I'm probably meant to create diffs of class definitions.!
- !ClassDiffBuilder commentStamp: 'klub 12/28/2009 05:14' prior: 0!
- I'm like TextDiffBuilder, but I split the input text by Character >> #separators, instead of new lines. I'm probably ment to create diffs of class definitions.!

Item was changed:
  Object subclass: #TextDiffBuilder
  	instanceVariableNames: 'xLines yLines ignoreLineEndings'
  	classVariableNames: 'IgnoreLineEndings InsertTextAttributes NormalTextAttributes RemoveTextAttributes'
  	poolDictionaries: ''
  	category: 'System-FilePackage'!
  
+ !TextDiffBuilder commentStamp: 'fbs 9/23/2013 08:58' prior: 0!
- !TextDiffBuilder commentStamp: 'ul 9/11/2013 01:05' prior: 0!
  I implement the diff algorithm. I can show the differences between two texts. See my method comments for further information.
  
  Instance Variables
  	xLines:				<Array>
  	yLines:				<Array>
  	ignoreLineEndings:	<Boolean>
  
  xLines
  	- an Array of DiffElements which is created from the first input text
  
  yLines
  	- an Array of DiffElements which is created from the second input text
  	
  ignoreLineEndings
+ 	- a Boolean describing whether lines only differing in the line endings should be reported as a difference, or not!
- 	- a Boolean describing wether lines only differing in the line endings should be reported as a difference, or not!

Item was changed:
  ----- Method: TextDiffBuilder>>lcsFor:and: (in category 'private') -----
  lcsFor: xFilteredLines and: yFilteredLines
+ 	"I find one of the longest common subsequences of my 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 third (and last) is the next node in the list, or nil, if there are no more elements. The list contains the longest common subsequence. I'm a modified version of the Greedy LCS/SES Algorithm from the 6th page of 'An O(ND) Difference Algorithm and Its Variations (1986)' by Eugene W. Myers."
- 	"I find one of the longest common subsequences of my 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 third (and 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/SES Algorithm from the 6th page of 'An O(ND) Difference Algorithm and Its Variations (1986)' by Eugene W. Myers"
  
  	| n m v lcss max index lcs x y |
  	n := xFilteredLines size.
  	m := yFilteredLines size.
  	max := m + n.
  	v := Array new: 2 * max + 1.
  	lcss := Array new: 2 * max + 1.
  	"Unrolled first iteration (d = 0, k = 0)"
  	index := max + 2.
  	y := x := v at: index put: 0.	
  	lcs := lcss at: index.
  	[ x < n and: [ y < m and: [ (xFilteredLines at: x + 1) = (yFilteredLines at: y + 1) ] ] ]
  		whileTrue: [ lcs := { x := x + 1. y := y + 1. lcs } ].
  	x >= n ifTrue: [ y >= m ifTrue: [ ^lcs ] ].
  	v at: max + 1 put: x.
  	lcss at: max + 1 put: lcs.
  	1 to: max do: [ :d |
  		"Unrolled lowest diagonal checks (k = -d)."
  		index := max - d + 2.
  		x := v at: index.
  		y := x + d.
  		lcs := lcss at: index.
  		[ x < n and: [ y < m and: [ (xFilteredLines at: x + 1) = (yFilteredLines at: y + 1) ] ] ]
  			whileTrue: [ lcs := { x := x + 1. y := y + 1. lcs } ].
  		x >= n ifTrue: [ y >= m ifTrue: [ ^lcs ] ].
  		v at: max - d + 1 put: x.
  		lcss at: max - d + 1 put: lcs.
  		"Inner diagonals. (k in [2-d..d-2])"
  		2 - d to: d - 2 by: 2 do: [ :k |
  			index := max + k.
  			(v at: index) < (v at: index + 2)
  				ifTrue: [ x := v at: (index := index + 2) ]
  				ifFalse: [ x := (v at: index) + 1 ].
  			y := x - k.
  			lcs := lcss at: index.
  			[ x < n and: [ y < m and: [ (xFilteredLines at: x + 1) = (yFilteredLines at: y + 1) ] ] ]
  				whileTrue: [ lcs := { x := x + 1. y := y + 1. lcs } ].
  			x >= n ifTrue: [ y >= m ifTrue: [ ^lcs ] ].
  			v at: max + k + 1 put: x.
  			lcss at: max + k + 1 put: lcs ].
  		"Unrolled highest diagonal checks (k = d)."
  		index := max + d.
  		x := (v at: index) + 1.
  		y := x - d.
  		lcs := lcss at: index.
  		[ x < n and: [ y < m and: [ (xFilteredLines at: x + 1) = (yFilteredLines at: y + 1) ] ] ]
  			whileTrue: [ lcs := { x := x + 1. y := y + 1. lcs } ].
  		x >= n ifTrue: [ y >= m ifTrue: [ ^lcs ] ].
  		v at: max + d + 1 put: x.
  		lcss at: max + d + 1 put: lcs ].
  	self error "We should never reach this point."!



More information about the Squeak-dev mailing list