The Trunk: Collections-nice.247.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-nice.247.mcz

commits-2
Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.247.mcz

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

Name: Collections-nice.247
Author: nice
Time: 9 December 2009, 9:25:48 am
UUID: 0c718ec5-e9fd-d54a-8813-7d55de313538
Ancestors: Collections-nice.246

Clean-up support code for mutating WideCharacterSet internal representation to ByteArray

=============== Diff against Collections-nice.246 ===============

Item was changed:
  ----- Method: Character>>asUnicode (in category 'converting') -----
  asUnicode
-
  | table charset v |
  self leadingChar = 0 ifTrue: [^ value].
+ (charset := EncodedCharSet charsetAt: self leadingChar)
+ isCharset ifFalse: [^ self charCode].
+ (table := charset ucsTable)
+ ifNil: [^ 16rFFFD].
+ (v := table at: 1 + self charCode)
+ = -1 ifTrue: [^ 16rFFFD].
- charset := EncodedCharSet charsetAt: self leadingChar.
- charset isCharset ifFalse: [^ self charCode].
- table := charset ucsTable.
- table isNil ifTrue: [^ 16rFFFD].
-
- v := table at: self charCode + 1.
- v = -1 ifTrue: [^ 16rFFFD].
-
  ^ v.
  !

Item was removed:
- ----- Method: WideCharacterSet>>convertInternalRepresentationToByteArray (in category 'private') -----
- convertInternalRepresentationToByteArray
- | oldMap |
- (map anySatisfy: [:e | e class == WordArray]) ifTrue: [
- oldMap := map.
- map := Dictionary new.
- oldMap keysAndValuesDo: [:i :words |
- self wordBitmap: words do: [:code | self add: (Character value: (i bitShift: 16) + code)]]].!

Item was removed:
- ----- Method: WideCharacterSet class>>initialize (in category 'class initialization') -----
- initialize
- "Old representation use WordArray.
- Accessing a WordArray can create slow LargeInteger and is inefficient.
- This is a temporary hack to mutate internal representation to faster ByteArray"
- self allInstancesDo: [:e | e convertInternalRepresentationToByteArray]!

Item was removed:
- ----- Method: WideCharacterSet>>wordBitmap:do: (in category 'private') -----
- wordBitmap: aMap do: aBlock
- "Execute a block with each value (0 based) corresponding to set bits"
-
- 0 to: 31 do: [:shift |
- | mask |
- mask := 1 bitShift: shift.
- 1 to: aMap size do: [:i |
- ((aMap at: i) bitAnd: mask) isZero ifFalse: [aBlock value: ((i - 1 bitShift: 5) bitOr: shift)]]]!