The Trunk: System-ul.389.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: System-ul.389.mcz

commits-2
Levente Uzonyi uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ul.389.mcz

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

Name: System-ul.389
Author: ul
Time: 2 November 2010, 10:06:25.693 pm
UUID: 77647d29-a395-fe4e-a7d0-013850bdfae2
Ancestors: System-ul.388

- a bit faster ClassDiffBuilder >> #split:
- TextDiffBuilder >> #buildDisplayPatch uses AttributedTextStream instead of TextStream, so it takes O(n) time to build a display patch, instead of O(n^2)

=============== Diff against System-ul.388 ===============

Item was changed:
  ----- Method: ClassDiffBuilder>>split: (in category 'private') -----
  split: aString
  "I return an array with aString splitted by Character >> #separators."
 
  ^Array streamContents: [ :stream |
+ | input separators |
+ input := aString readStream.
+ separators := CharacterSet separators.
+ [ input atEnd ] whileFalse: [
+ | word separator |
+ word := input
+ upToAnyOf: separators
+ do: [ :matchingSeparator |
+ separator := matchingSeparator ].
+ stream nextPut: (separator
+ ifNil: [ word ]
+ ifNotNil: [ word, separator asString ]) ] ]!
- | out |
- out := aString copy writeStream.
- aString do: [ :c |
- out nextPut: c.
- c isSeparator ifTrue:[
- stream nextPut: out contents.
- out reset ] ].
- out position = 0 ifFalse: [
- stream nextPut: out contents ] ]!

Item was changed:
  ----- Method: TextDiffBuilder>>buildDisplayPatch (in category 'creating patches') -----
  buildDisplayPatch
 
+ | stream |
+ stream := AttributedTextStream new.
+ self
+ patchSequenceDoIfMatch: [ :string |
+ self print: string withAttributes: NormalTextAttributes on: stream ]
+ ifInsert: [ :string |
+ self print: string withAttributes: InsertTextAttributes on: stream ]
+ ifRemove: [ :string |
+ self print: string withAttributes: RemoveTextAttributes on: stream ].
+ ^stream contents!
- ^Text streamContents: [ :stream |
- self
- patchSequenceDoIfMatch: [ :string |
- self print: string withAttributes: NormalTextAttributes on: stream ]
- ifInsert: [ :string |
- self print: string withAttributes: InsertTextAttributes on: stream ]
- ifRemove: [ :string |
- self print: string withAttributes: RemoveTextAttributes on: stream ] ]!