[Pkg] DeltaStreams: DeltaStreams-Model-gk.5.mcz
squeak-dev-noreply at lists.squeakfoundation.org
squeak-dev-noreply at lists.squeakfoundation.org
Mon Mar 9 20:22:26 UTC 2009
A new version of DeltaStreams-Model was added to project DeltaStreams:
http://www.squeaksource.com/DeltaStreams/DeltaStreams-Model-gk.5.mcz
==================== Summary ====================
Name: DeltaStreams-Model-gk.5
Author: gk
Time: 9 March 2009, 9:22:20 pm
UUID: 848edde4-01e9-4a02-94ea-e08d2f76c729
Ancestors: DeltaStreams-Model-mtf.4
- Lots of "self changes" to accommodate new ivar compositeChange in DSDelta.
- Moved code from DSDelta to DSChangeSequence, closer to the changes collection they operate on.
=============== Diff against DeltaStreams-Model-mtf.4 ===============
Item was changed:
----- Method: DSDelta>>isEmpty (in category 'testing') -----
isEmpty
+ ^self changes isEmpty!
- ^changes isEmpty!
Item was added:
+ ----- Method: DSChangeSequence>>removeShadows (in category 'applying') -----
+ removeShadows
+ "Remove all changes that are shadowed (redundant).
+ We go in reverse and remove all changes before
+ each change that it shadows. The logic is all based
+ on #canShadow and #isShadowing:. To make it
+ at least somewhat efficient we nil out the changes
+ and then remove them in one big swoop at the end."
+
+ | candidate change |
+ changes size to: 2 by: -1 do: [:index |
+ change := changes at: index.
+ (change notNil and: [change canShadow]) ifTrue: [
+ index - 1 to: 1 by: -1 do: [:i |
+ candidate := changes at: i.
+ (candidate notNil and: [change isShadowing: candidate])
+ ifTrue: [changes at: i put: nil]]]].
+ changes := changes select: [:each | each notNil]!
Item was added:
+ ----- Method: DSChangeSequence>>moveClassNameChanges (in category 'applying') -----
+ moveClassNameChanges
+ "Move all class name changes to the beginning as if they were made first."
+
+ | nameChanges map |
+ nameChanges := OrderedCollection new.
+ map := Dictionary new.
+ changes reverseDo: [:change |
+ change isClassName
+ ifTrue: [
+ "Is there already a mapping in place?"
+ (map includesKey: change newName)
+ ifTrue: [
+ "Then we remap it using the even older name as key from now on"
+ map at: change oldName put: (map at: change newName).
+ map removeKey: change newName]
+ ifFalse: [
+ "Then we just add a mapping."
+ map at: change oldName put: change newName].
+ nameChanges add: change ]
+ ifFalse: [
+ change remapClassNames: map]].
+ changes removeAll: nameChanges.
+ changes := nameChanges, changes!
Item was changed:
----- Method: DSDelta>>changesMaybeRevertable (in category 'testing') -----
changesMaybeRevertable
"Are all changes per definition revertable
or marked by the developer as being revertable?"
+ ^self changes allSatisfy: [:change | change isMaybeRevertable]!
- ^changes allSatisfy: [:change | change isMaybeRevertable]!
Item was added:
+ ----- Method: DSChangeSequence>>clearChanges (in category 'applying') -----
+ clearChanges
+ "Remove all changes and return them."
+
+ | oldChanges |
+ oldChanges := changes.
+ changes := nil.
+ ^oldChanges!
Item was changed:
----- Method: DSDelta>>uuid: (in category 'initialize-release') -----
uuid: aUUID
super initialize.
uuid := aUUID.
changeCounter := 0.
- changes := OrderedCollection new.
notRevertable := false
!
Item was changed:
----- Method: DSDelta>>classGroupsDo: (in category 'applying') -----
classGroupsDo: aBlock
"Execute a block for all groups of changes per class."
| groups coll |
groups := Dictionary new.
+ self changes do: [:each |
- changes do: [:each |
coll := groups at: each className ifAbsentPut: [SortedCollection new].
coll add: each].
groups values do: [:group | aBlock value: group]!
Item was changed:
----- Method: DSDelta>>fixChangeNumbers (in category 'utilities') -----
fixChangeNumbers
"Fix the change numbers to conform to the invariant that the number
+ of the change is the same as it's index in the change collection."
- of the change is the same as it's index in the change array."
+ | chgs |
+ chgs := self changes.
+ chgs withIndexDo: [:change :index | change number: index].
+ changeCounter := chgs size!
- changes withIndexDo: [:change :index | change number: index].
- changeCounter := changes size!
Item was changed:
----- Method: DSDelta>>normalize (in category 'applying') -----
normalize
"Modify changes so that they are compacted into the minimal form
still producing the equivalent end result. In other words - remove redundancy."
+ compositeChange ifNotNil: [
+ compositeChange moveClassNameChanges; removeShadows; mergeChanges]!
- self moveClassNameChanges; removeShadows; mergeChanges!
Item was removed:
- ----- Method: DSDelta>>moveClassNameChanges (in category 'applying') -----
- moveClassNameChanges
- "Move all class name changes to the beginning as if they were made first."
-
- | nameChanges map |
- nameChanges := OrderedCollection new.
- map := Dictionary new.
- changes reverseDo: [:change |
- change isClassName
- ifTrue: [
- "Is there already a mapping in place?"
- (map includesKey: change newName)
- ifTrue: [
- "Then we remap it using the even older name as key from now on"
- map at: change oldName put: (map at: change newName).
- map removeKey: change newName]
- ifFalse: [
- "Then we just add a mapping."
- map at: change oldName put: change newName].
- nameChanges add: change ]
- ifFalse: [
- change remapClassNames: map]].
- changes removeAll: nameChanges.
- changes := nameChanges, changes!
Item was removed:
- ----- Method: DSDelta>>removeShadows (in category 'applying') -----
- removeShadows
- "Remove all changes that are shadowed (redundant).
- We go in reverse and remove all changes before
- each change that it shadows. The logic is all based
- on #canShadow and #isShadowing:. To make it
- at least somewhat efficient we nil out the changes
- and then remove them in one big swoop at the end."
-
- | candidate change |
- changes size to: 2 by: -1 do: [:index |
- change := changes at: index.
- (change notNil and: [change canShadow]) ifTrue: [
- index - 1 to: 1 by: -1 do: [:i |
- candidate := changes at: i.
- (candidate notNil and: [change isShadowing: candidate])
- ifTrue: [changes at: i put: nil]]]].
- changes := changes select: [:each | each notNil]!
Item was removed:
- ----- Method: DSDelta>>clearChanges (in category 'applying') -----
- clearChanges
- "Remove all changes and return them."
-
- | oldChanges |
- oldChanges := changes.
- changes := OrderedCollection new.
- ^oldChanges!
More information about the Packages
mailing list