[Pkg] The Trunk: System-ul.398.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Dec 8 20:34:00 UTC 2010


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

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

Name: System-ul.398
Author: ul
Time: 8 December 2010, 9:21:23.04 pm
UUID: 8e147d50-061f-6741-8eb3-b8f69182a3de
Ancestors: System-ul.397

- fix: SystemDictionary >> #traitNames returns a sorted collection. It also uses the cached nonClassNames which is faster.
- added SystemDictionary >> #classAndTraitNames which returns a sorted collection of all class and trait names

=============== Diff against System-ul.397 ===============

Item was added:
+ ----- 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.
+ 	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!

Item was changed:
  ----- Method: SystemDictionary>>traitNames (in category 'classes and traits') -----
  traitNames
+ 	"Answer a sorted collection of all traits (not including class-traits) names."
+ 
+ 	^self nonClassNames select: [ :name |
+ 		(name beginsWith: 'AnObsolete') not and: [
+ 			self 
+ 				at: name 
+ 				ifPresent: [ :global | global isInMemory and: [ global isTrait ] ]
+ 				ifAbsent: [ false ] ] ]!
- 	"Answer a SortedCollection of all traits (not including class-traits) names."
- 	| names |
- 	names := OrderedCollection new.
- 	self do: 
- 		[:cl | (cl isInMemory
- 			and: [(cl isTrait)
- 			and: [(cl name beginsWith: 'AnObsolete') not]])
- 				ifTrue: [names add: cl name]].
- 	^ names!



More information about the Packages mailing list