The Trunk: Collections-ul.649.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-ul.649.mcz

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

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

Name: Collections-ul.649
Author: ul
Time: 23 August 2015, 11:59:16.66 pm
UUID: 4d8f9b81-5a5c-41b3-a466-a05df4a883ff
Ancestors: Collections-ul.648

- removed migration code from CharacterSet

=============== Diff against Collections-ul.648 ===============

Item was changed:
  ----- Method: CharacterSet>>= (in category 'comparison') -----
  = anObject
 
  self species == anObject species ifFalse: [ ^false ].
- self size. "to migrate existing instances"
  anObject size = tally ifFalse: [ ^false ].
  ^self byteArrayMap = anObject byteArrayMap!

Item was changed:
  ----- Method: CharacterSet>>add: (in category 'collection ops') -----
  add: aCharacter
  "I automatically become a WideCharacterSet if you add a wide character to myself"
 
  | index |
  (index := aCharacter asInteger + 1) <= 256 ifFalse: [
  | wide |
  wide := WideCharacterSet new.
  wide addAll: self.
  wide add: aCharacter.
  self becomeForward: wide.
  ^aCharacter ].
+ (map at: index) = 1 ifFalse: [
+ map at: index put: 1.
+ tally := tally + 1 ].
- (map at: index) = 1 ifTrue: [ ^aCharacter ].
- self size. "to migrate existing instances."
- map at: index put: 1.
- tally := tally + 1.
  ^aCharacter!

Item was changed:
  ----- Method: CharacterSet>>do: (in category 'collection ops') -----
  do: aBlock
  "evaluate aBlock with each character in the set"
 
  | index |
- self size. "to migrate existing instances"
  tally >= 128 ifTrue: [ "dense"
  index := 0.
  [ (index := index + 1) <= 256 ] whileTrue: [
  (map at: index) = 1 ifTrue: [
  aBlock value: (Character value: index - 1) ] ].
  ^self ].
  "sparse"
  index := 0.
  [ (index := map indexOf: 1 startingAt: index + 1) = 0 ] whileFalse: [
  aBlock value: (Character value: index - 1) ].
  !

Item was changed:
  ----- Method: CharacterSet>>remove:ifAbsent: (in category 'collection ops') -----
  remove: aCharacter ifAbsent: aBlock
 
  | index |
  (index := aCharacter asciiValue + 1) <= 256 ifFalse: [ ^aBlock value ].
  (map at: index) = 0 ifTrue: [ ^aBlock value ].
- self size. "to migrate existing instances."
  map at: index put: 0.
  tally := tally - 1.
  ^aCharacter!

Item was changed:
  ----- Method: CharacterSet>>size (in category 'collection ops') -----
  size
 
+ ^tally!
- ^tally ifNil: [
- | index count |
- index := count := 0.
- [ (index := map indexOf: 1 startingAt: index + 1) = 0 ] whileFalse: [
- count := count + 1 ].
- tally := count ]!