[squeak-dev] The Trunk: System-ul.423.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Feb 28 11:13:26 UTC 2011


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

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

Name: System-ul.423
Author: ul
Time: 28 February 2011, 12:05:19.782 pm
UUID: 5334bfde-1537-fa4a-8491-4219f54632ce
Ancestors: System-ul.422

- moved all class and trait access logic from SmalltalkImage to SystemDictionary
- simplified a few methods in SystemDictionary

=============== Diff against System-ul.422 ===============

Item was changed:
  ----- Method: SmalltalkImage>>allClasses (in category 'classes and traits') -----
  allClasses  
  	"Return all the class defined in the system"
  
+ 	^globals allClasses!
- 	^Array streamContents:[:s| self allClassesDo:[:aClass| s nextPut: aClass]].!

Item was changed:
  ----- Method: SmalltalkImage>>allClassesAndTraits (in category 'classes and traits') -----
  allClassesAndTraits
  	"Return all the classes and traits defined in the system"
  
+ 	^globals allClassesAndTraits!
- 	^Array streamContents:[:s| self allClassesAndTraitsDo:[:each| s nextPut: each]].!

Item was changed:
  ----- Method: SmalltalkImage>>allClassesAndTraitsDo: (in category 'classes and traits') -----
  allClassesAndTraitsDo: aBlock
  	"Evaluate the argument, aBlock, for each class and trait in the system."
  
+ 	globals allClassesAndTraitsDo: aBlock!
- 	self allClassesDo: aBlock.
- 	self allTraitsDo: aBlock.
- !

Item was changed:
  ----- Method: SmalltalkImage>>allClassesDo: (in category 'classes and traits') -----
  allClassesDo: aBlock
  	"Evaluate the argument, aBlock, for each class in the system."
  
+ 	globals allClassesDo: aBlock!
- 	^globals allClassesDo: aBlock!

Item was changed:
  ----- Method: SmalltalkImage>>allTraits (in category 'classes and traits') -----
  allTraits
  	"Return all traits defined in the system"
  
+ 	^globals allTraits!
- 	^Array streamContents:[:s| self allTraitsDo:[:aTrait| s nextPut: aTrait]].!

Item was changed:
  ----- Method: SmalltalkImage>>allTraitsDo: (in category 'classes and traits') -----
  allTraitsDo: aBlock
  	"Evaluate the argument, aBlock, for each trait in the system."
  
+ 	globals allTraitsDo: aBlock!
- 	^globals allTraitsDo: aBlock!

Item was changed:
  ----- Method: SmalltalkImage>>classNames (in category 'classes and traits') -----
  classNames
  	"Answer a collection of all class names in the system."
  
+ 	^globals classNames!
- 	^self allClasses collect:[:aClass| aClass name].!

Item was changed:
  ----- Method: SmalltalkImage>>traitNames (in category 'classes and traits') -----
  traitNames
  	"Answer a SortedCollection of all traits (not including class-traits) names."
  
+ 	^globals traitNames!
- 	^self allTraits collect:[:aTrait| aTrait name].!

Item was changed:
  ----- Method: SystemDictionary>>allClassesAndTraits (in category 'classes and traits') -----
  allClassesAndTraits
  	"Return all the classes and traits defined in the Smalltalk SystemDictionary"
  
+ 	^Array streamContents: [ :stream |
+ 		self allClassesAndTraitsDo: [ :each | stream nextPut: each ] ]!
- 	^ self classNames , self traitNames collect: [:each | self at: each]!

Item was changed:
  ----- Method: SystemDictionary>>allClassesAndTraitsDo: (in category 'classes and traits') -----
  allClassesAndTraitsDo: aBlock
+ 	
+ 	self
+ 		allClassesDo: aBlock;
+ 		allTraitsDo: aBlock!
- 	^self allClassesAndTraits do: aBlock!

Item was changed:
  ----- Method: SystemDictionary>>allClassesDo: (in category 'classes and traits') -----
  allClassesDo: aBlock
  	"Evaluate the argument, aBlock, for each class in the system."
  
+ 	self classNames do: [ :name |
+ 		aBlock value: (self at: name) ]!
- 	(self classNames collect: [:name | self at: name]) do: aBlock!

Item was changed:
  ----- Method: SystemDictionary>>allTraitsDo: (in category 'classes and traits') -----
  allTraitsDo: aBlock
  	"Evaluate the argument, aBlock, for each trait in the system."
  
+ 	self traitNames do: [ :name |
+ 		aBlock value: (self at: name) ]!
- 	(self traitNames collect: [:name | self at: name]) do: aBlock!

Item was changed:
  ----- Method: SystemDictionary>>classAndTraitNames (in category 'classes and traits') -----
  classAndTraitNames
  	"Answer a sorted collection of all class and trait (not including class-traits) names. The performance of this algorithm is O(n) if the classNames are already cached, otherwise O(n*log(n)) where n is self size."
  
  	| classNames traitNames result temporary |
  	classNames := self classNames.
+ 	traitNames := self traitNames ifEmpty: [ ^classNames ].
- 	traitNames := self traitNames.
- 	traitNames ifEmpty: [^classNames].
  	temporary := Array new: classNames size + traitNames size.
  	result := temporary shallowCopy.
  	temporary
  		replaceFrom: 1
  		to: classNames size
  		with: classNames
  		startingAt: 1;
  		replaceFrom: classNames size + 1
  		to: temporary size
  		with: traitNames
  		startingAt: 1;
  		mergeFirst: 1
  		middle: classNames size
  		last: temporary size
  		into: result
  		by: nil.
  	^result!




More information about the Squeak-dev mailing list