[squeak-dev] The Trunk: Collections-ul.530.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Sep 4 19:08:19 UTC 2013


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

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

Name: Collections-ul.530
Author: ul
Time: 4 September 2013, 8:59:21.417 pm
UUID: ea12e381-2990-4d8e-9efb-d034bc676f9f
Ancestors: Collections-ul.529

Fixed/refactored #selectorsContaining:, #selectorsMatching: and #allSymbols in Symbol class.

=============== Diff against Collections-ul.529 ===============

Item was changed:
  ----- Method: Symbol class>>allSymbols (in category 'access') -----
  allSymbols
  	"Answer all interned symbols"
+ 	
+ 	^Array
+ 		new: NewSymbols slowSize + SymbolTable slowSize
+ 		streamContents:[ :stream |
+ 			stream
+ 				nextPutAll: NewSymbols;
+ 				nextPutAll: SymbolTable ]
- 	^Array streamContents:[:s|
- 		s nextPutAll: NewSymbols.
- 		s nextPutAll: OneCharacterSymbols.
- 		s nextPutAll: SymbolTable.
- 	].
  !

Item was changed:
  ----- Method: Symbol class>>selectorsContaining: (in category 'access') -----
  selectorsContaining: aString
+ 	"Answer a list of selectors that contain aString within them. Case-insensitive. Does return symbols that begin with a capital letter."
- 	"Answer a list of selectors that contain aString within them. Case-insensitive.  Does return symbols that begin with a capital letter."
  
+ 	| size selectorList |
- 	| size selectorList ascii |
- 
  	selectorList := OrderedCollection new.
+ 	(size := aString size) = 0 ifTrue: [ ^selectorList ].
+ 	self allSymbolTablesDo: [ :each |
+ 		(each size >= size
+ 			and: [ (each includesSubstring: aString caseSensitive: false) 
+ 			and: [ each numArgs ~= -1 ] ])
+ 				ifTrue: [ selectorList add: each ] ].
+ 	^selectorList
- 	(size := aString size) = 0 ifTrue: [^selectorList].
  
+ 	"Symbol selectorsContaining: 'scon'"!
- 	aString size = 1 ifTrue:
- 		[
- 			ascii := aString first asciiValue.
- 			ascii < 128 ifTrue: [selectorList add: (OneCharacterSymbols at: ascii+1)]
- 		].
- 
- 	(aString first isLetter or: [aString first isDigit]) ifFalse:
- 		[
- 			aString size = 2 ifTrue: 
- 				[Symbol hasInterned: aString ifTrue:
- 					[:s | selectorList add: s]].
- 			^selectorList
- 		].
- 
- 	selectorList := selectorList copyFrom: 2 to: selectorList size.
- 
- 	self allSymbolTablesDo: [:each |
- 		each size >= size ifTrue:
- 			[(each findSubstring: aString in: each startingAt: 1 
- 				matchTable: CaseInsensitiveOrder) > 0
- 						ifTrue: [selectorList add: each]]].
- 
- 	^selectorList reject: [:each | "reject non-selectors, but keep ones that begin with an uppercase"
- 		each numArgs < 0 and: [each asString withFirstCharacterDownshifted numArgs < 0]].
- 
- "Symbol selectorsContaining: 'scon'"!

Item was changed:
  ----- Method: Symbol class>>selectorsMatching: (in category 'access') -----
  selectorsMatching: aStringPattern
+ 	"Answer a list of selectors that match aStringPattern within them. Case-insensitive. Does return symbols that begin with a capital letter."
- 	"Answer a list of selectors that match aStringPattern within them. Case-insensitive.
- 	 Does return symbols that begin with a capital letter."
  
  	| selectorList |
- 
  	selectorList := OrderedCollection new.
+ 	aStringPattern isEmpty ifTrue: [ ^selectorList ].
+ 	self allSymbolTablesDo: [ :each | 
+ 		((aStringPattern match: each) and: [ each numArgs ~= -1 ])
+ 			ifTrue: [selectorList add: each ] ].
+ 	^selectorList
  
- 	aStringPattern isEmpty ifTrue: [^selectorList].
- 
- 	self allSymbolTablesDo:
- 		[:each | (aStringPattern match: each) ifTrue: [selectorList add: each]].
- 
- 	^selectorList reject: "reject non-selectors, but keep ones that begin with an uppercase"
- 		[:each | each numArgs < 0 and: [each asString withFirstCharacterDownshifted numArgs < 0]]
- 
  	"Symbol selectorsMatching: 'parse:*'"!

Item was changed:
  ----- Method: WeakSet>>do: (in category 'enumerating') -----
  do: aBlock
  
  	tally = 0 ifTrue: [ ^self ].
  	1 to: array size do: [ :index |
  		(array at: index) ifNotNil: [ :object |
+ 			object == flag ifFalse: [
- 			object  == flag ifFalse: [
  				aBlock value: object enclosedSetElement] ] ]!



More information about the Squeak-dev mailing list