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

commits at source.squeak.org commits at source.squeak.org
Fri Aug 14 20:27:20 UTC 2015


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

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

Name: Collections-ul.641
Author: ul
Time: 14 August 2015, 6:59:54.138 pm
UUID: c373bfdf-0a07-40c8-8505-75c157cbb352
Ancestors: Collections-ul.640

Character:
- even faster #isSeparator
- class side #initialize sends #initializeClassificationTable
- atomic class side #initializeDigitValues

String:
- renamed #includesSubString: to #includesSubstring:
- deprecated #includesSubString:

General:
#includesSubString: -> #includesSubstring:

=============== Diff against Collections-ul.640 ===============

Item was changed:
  ----- Method: Character class>>initialize (in category 'class initialization') -----
  initialize
- 	"Create the DigitsValues table."
  	"Character initialize"
+ 	
+ 	self
+ 		initializeClassificationTable;
+ 		initializeDigitValues!
- 	self initializeDigitValues!

Item was changed:
  ----- Method: Character class>>initializeDigitValues (in category 'class initialization') -----
  initializeDigitValues
  	"Initialize the well known digit value of ascii characters.
  	Note that the DigitValues table is 1-based while ascii values are 0-based, thus the offset +1."
  	
+ 	| newDigitValues |
+ 	newDigitValues := Array new: 256 withAll: -1.
- 	DigitValues := Array new: 256 withAll: -1.
  	"the digits"
+ 	0 to: 9 do: [:i | newDigitValues at: 48 + i + 1 put: i].
- 	0 to: 9 do: [:i | DigitValues at: 48 + i + 1 put: i].
  	"the uppercase letters"
+ 	10 to: 35 do: [:i | newDigitValues at: 55 + i + 1 put: i].
- 	10 to: 35 do: [:i | DigitValues at: 55 + i + 1 put: i].
  	"the lowercase letters"
+ 	10 to: 35 do: [:i | newDigitValues at: 87 + i + 1 put: i].
+ 	DigitValues := newDigitValues!
- 	10 to: 35 do: [:i | DigitValues at: 87 + i + 1 put: i].!

Item was changed:
  ----- Method: Character>>isSeparator (in category 'testing') -----
  isSeparator
  	"Answer whether the receiver is one of the separator characters--space, 
  	cr, tab, line feed, or form feed."
  
  	| integerValue |
+ 	(integerValue := self asInteger) > 32 ifTrue: [ ^false ].
+ 	integerValue
+ 		caseOf: {
+ 			[ 32 "space" ] -> [ ^true ].
+ 			[ 9 "cr" ] -> [ ^true ].
+ 			[ 13 "tab"] -> [ ^true ].
+ 			[ 10 "line feed" ] -> [ ^true ] }
+ 		otherwise: [ ^integerValue = 12 "form feed" ]!
- 	(integerValue := self asInteger) = 32 ifTrue: [ ^true ].	"space"
- 	integerValue = 9 ifTrue: [ ^true ].	"tab"
- 	integerValue = 13 ifTrue: [ ^true ].	"cr"
- 	integerValue = 10 ifTrue: [ ^true ].	"line feed"
- 	^integerValue = 12	"form feed"!

Item was changed:
  ----- Method: Collection>>includesSubstringAnywhere: (in category 'testing') -----
  includesSubstringAnywhere: testString
  	"Answer whether the receiver includes, anywhere in its nested structure, a string that has testString as a substring"
  	self do:
  		[:element |
  			(element isString)
  				ifTrue:
+ 					[(element includesSubstring: testString) ifTrue: [^ true]].
- 					[(element includesSubString: testString) ifTrue: [^ true]].
  			(element isCollection)
  				ifTrue:
  					[(element includesSubstringAnywhere: testString) ifTrue: [^ true]]].
  	^ false
  
  "#(first (second third) ((allSentMessages ('Elvis' includes:)))) includesSubstringAnywhere:  'lvi'"!

Item was changed:
  ----- Method: String>>findTokens:includes: (in category 'accessing') -----
  findTokens: delimiters includes: subString
  	"Divide self into pieces using delimiters.  Return the piece that includes subString anywhere in it.  Is case sensitive (say asLowercase to everything beforehand to make insensitive)."
  
  ^ (self findTokens: delimiters) 
+ 	detect: [:str | (str includesSubstring: subString)] 
- 	detect: [:str | (str includesSubString: subString)] 
  	ifNone: [nil]!

Item was changed:
  ----- Method: String>>includesSubString: (in category 'testing') -----
  includesSubString: subString
+ 
+ 	self deprecated: 'Use #includesSubstring: instead.'.
+ 	^self includesSubstring: subString!
- 	^ (self findString: subString startingAt: 1) > 0!

Item was added:
+ ----- Method: String>>includesSubstring: (in category 'testing') -----
+ includesSubstring: aString
+ 
+ 	^(self findString: aString startingAt: 1) > 0!



More information about the Squeak-dev mailing list