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

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

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

Name: Collections-nice.794
Author: nice
Time: 4 May 2018, 12:48:13.071978 am
UUID: 1ffc2862-2360-4a20-876b-782ae5cb72f5
Ancestors: Collections-eem.793

Provide CharacterSet includesCode: and also ASCII and non ASCII maps.

=============== Diff against Collections-eem.793 ===============

Item was removed:
- ----- Method: ByteCharacterSet>>includes: (in category 'testing') -----
- includes: anObject
-
- | index |
- anObject isCharacter ifFalse: [ ^false ].
- (index := anObject asInteger + 1) > 256 ifTrue: [ ^false ].
- ^(byteArrayMap at: index) > 0!

Item was added:
+ ----- Method: ByteCharacterSet>>includesCode: (in category 'testing') -----
+ includesCode: anInteger
+ anInteger > 255 ifTrue: [ ^false ].
+ ^(byteArrayMap at: anInteger + 1) > 0!

Item was changed:
  Collection subclass: #CharacterSet
  instanceVariableNames: 'byteArrayMap'
+ classVariableNames: 'Ascii CrLf NonAscii NonSeparators Separators'
- classVariableNames: 'CrLf NonSeparators Separators'
  poolDictionaries: ''
  category: 'Collections-Support'!
 
  !CharacterSet commentStamp: '<historical>' prior: 0!
  A set of characters.  Lookups for inclusion are very fast.!

Item was added:
+ ----- Method: CharacterSet class>>ascii (in category 'accessing') -----
+ ascii
+ "return a set containing all the ASCII characters"
+
+ ^Ascii ifNil: [ Ascii := self newFrom: ((1 to: 127) collect: [:code | code asCharacter]) ]!

Item was added:
+ ----- Method: CharacterSet class>>nonAscii (in category 'accessing') -----
+ nonAscii
+ "return a set containing all the non ASCII characters"
+
+ ^NonAscii ifNil: [ NonAscii := self ascii complement ]!

Item was changed:
  ----- Method: CharacterSet>>createByteArrayMap (in category 'private') -----
  createByteArrayMap
+ ^ (0 to: 255)
+ collect: [:i | (self includesCode: i) ifTrue: [1] ifFalse: [0]]
+ as: ByteArray!
- ^ (0 to: 255) asByteArray collect:
- [:i | (self includes: (Character value: i)) ifTrue: [1] ifFalse: [0]]!

Item was added:
+ ----- Method: CharacterSet>>includes: (in category 'testing') -----
+ includes: anObject
+ anObject isCharacter ifFalse: [ ^false ].
+ ^self includesCode: anObject asInteger!

Item was added:
+ ----- Method: CharacterSet>>includesCode: (in category 'testing') -----
+ includesCode: anInteger
+ ^self subclassResponsibility!

Item was removed:
- ----- Method: CharacterSetComplement>>includes: (in category 'testing') -----
- includes: anObject
-
- anObject isCharacter ifFalse: [ ^false ].
- (absent includes: anObject) ifTrue: [ ^false ].
- ^true!

Item was added:
+ ----- Method: CharacterSetComplement>>includesCode: (in category 'testing') -----
+ includesCode: anInteger
+ (absent includesCode: anInteger) ifTrue: [ ^false ].
+ ^true!

Item was added:
+ ----- Method: LazyCharacterSet>>includesCode: (in category 'testing') -----
+ includesCode: anInteger
+ ^block value: (Character value: anInteger)!

Item was changed:
+ ----- Method: WeakIdentityDictionary>>removeUnreferencedKeys (in category 'removing') -----
- ----- Method: WeakIdentityDictionary>>removeUnreferencedKeys (in category 'as yet unclassified') -----
  removeUnreferencedKeys
  "Make sure tally is set to the right size by #compact."
 
  super removeUnreferencedKeys.
  self compact!

Item was removed:
- ----- Method: WideCharacterSet>>includes: (in category 'testing') -----
- includes: anObject
-
- | value |
- anObject isCharacter ifFalse: [ ^false ].
- (value := anObject asInteger) < 256 ifTrue: [
- ^(byteArrayMap at: value + 1) ~= 0 ].
- ^((map at: (value bitShift: highBitsShift) ifAbsent: nil) ifNil: [ ^false ])
- includes: (value bitAnd: lowBitsMask)!

Item was added:
+ ----- Method: WideCharacterSet>>includesCode: (in category 'testing') -----
+ includesCode: anInteger
+ anInteger < 256 ifTrue: [ ^(byteArrayMap at: anInteger + 1) ~= 0 ].
+ ^((map at: (anInteger bitShift: highBitsShift) ifAbsent: nil) ifNil: [ ^false ])
+ includes: (anInteger bitAnd: lowBitsMask)!