[squeak-dev] The Trunk: Kernel-nice.307.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Nov 29 20:54:11 UTC 2009


Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.307.mcz

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

Name: Kernel-nice.307
Author: nice
Time: 29 November 2009, 9:53:32 am
UUID: 32793c3c-4bcd-4323-9c9a-277b9345634e
Ancestors: Kernel-nice.306

http://bugs.squeak.org/view.php?id=7218
ClassOrganizer categories breaks if given an empty array 
because categoryStops gets set to #() when it should be at least #(0) 

=============== Diff against Kernel-nice.306 ===============

Item was changed:
  ----- Method: Categorizer>>categories: (in category 'accessing') -----
+ categories: anArray
- categories: anArray 
  	"Reorder my categories to be in order of the argument, anArray. If the 
  	resulting organization does not include all elements, then give an error."
  
  	| newCategories newStops newElements catName list runningTotal | 
+ 	
+ 	anArray size < 2 ifTrue: [ ^ self ].
+ 	
  	newCategories := Array new: anArray size.
  	newStops := Array new: anArray size.
  	newElements := Array new: 0.
  	runningTotal := 0.
  	1 to: anArray size do:
  		[:i |
  		catName := (anArray at: i) asSymbol.
  		list := self listAtCategoryNamed: catName.
  				newElements := newElements, list.
  				newCategories at: i put: catName.
  				newStops at: i put: (runningTotal := runningTotal + list size)].
  	elementArray do:
  		[:element | "check to be sure all elements are included"
  		(newElements includes: element)
  			ifFalse: [^self error: 'New categories must match old ones']].
  	"Everything is good, now update my three arrays."
  	categoryArray := newCategories.
  	categoryStops := newStops.
  	elementArray := newElements!




More information about the Squeak-dev mailing list