[squeak-dev] The Trunk: Collections-ul.573.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Jul 8 00:03:45 UTC 2014
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.573.mcz
==================== Summary ====================
Name: Collections-ul.573
Author: ul
Time: 7 July 2014, 10:02:49.741 pm
UUID: 189a8283-4840-4746-8807-47f3597745fd
Ancestors: Collections-nice.572
Character changes
- introduced #encodedCharSet to access the EncodedCharSet of a character
- all methods use #encodedCharSet instead of (EncodedCharSet charSetAt: self leadingChar)
- #isAlphaNumeric uses the EncodedCharSet class's #isAlphaNumeric: method
=============== Diff against Collections-nice.572 ===============
Item was changed:
----- Method: Character>>asLowercase (in category 'converting') -----
asLowercase
"If the receiver is uppercase, answer its matching lowercase Character."
"A tentative implementation. Eventually this should consult the Unicode table."
| v |
v := self charCode.
(((8r101 <= v and: [v <= 8r132]) or: [16rC0 <= v and: [v <= 16rD6]]) or: [16rD8 <= v and: [v <= 16rDE]])
ifTrue: [^ Character value: v + 8r40].
v < 256 ifTrue: [^self].
^self class value: ((value < 16r400000
ifTrue: [Unicode]
+ ifFalse: [self encodedCharSet charsetClass])
- ifFalse: [(EncodedCharSet charsetAt: self leadingChar) charsetClass])
toLowercaseCode: v)!
Item was changed:
----- Method: Character>>asUnicode (in category 'converting') -----
asUnicode
"Answer the unicode encoding of the receiver"
self leadingChar = 0 ifTrue: [^ value].
+ ^self encodedCharSet charsetClass convertToUnicode: self charCode
- ^(EncodedCharSet charsetAt: self leadingChar) charsetClass convertToUnicode: self charCode
!
Item was changed:
----- Method: Character>>asUppercase (in category 'converting') -----
asUppercase
"If the receiver is lowercase, answer its matching uppercase Character."
"A tentative implementation. Eventually this should consult the Unicode table."
| v |
v := self charCode.
(((8r141 <= v and: [v <= 8r172]) or: [16rE0 <= v and: [v <= 16rF6]]) or: [16rF8 <= v and: [v <= 16rFE]])
ifTrue: [^ Character value: v - 8r40].
v < 256 ifTrue: [^self].
^self class value: ((value < 16r400000
ifTrue: [Unicode]
+ ifFalse: [self encodedCharSet charsetClass])
- ifFalse: [(EncodedCharSet charsetAt: self leadingChar) charsetClass])
toUppercaseCode: v)!
Item was changed:
----- Method: Character>>canBeGlobalVarInitial (in category 'testing') -----
canBeGlobalVarInitial
+ ^self encodedCharSet canBeGlobalVarInitial: self!
- ^ (EncodedCharSet charsetAt: self leadingChar) canBeGlobalVarInitial: self.
- !
Item was changed:
----- Method: Character>>canBeNonGlobalVarInitial (in category 'testing') -----
canBeNonGlobalVarInitial
+ ^self encodedCharSet canBeNonGlobalVarInitial: self
- ^ (EncodedCharSet charsetAt: self leadingChar) canBeNonGlobalVarInitial: self.
!
Item was changed:
----- Method: Character>>digitValue (in category 'accessing') -----
digitValue
"Answer 0-9 if the receiver is $0-$9, 10-35 if it is $A-$Z, and < 0
otherwise. This is used to parse literal numbers of radix 2-36."
+ value > 16rFF ifTrue: [^self encodedCharSet digitValueOf: self].
- value > 16rFF ifTrue: [^(EncodedCharSet charsetAt: self leadingChar) digitValueOf: self].
^DigitValues at: 1 + value!
Item was added:
+ ----- Method: Character>>encodedCharSet (in category 'accessing') -----
+ encodedCharSet
+
+ ^EncodedCharSet charsetAt: self leadingChar
+ !
Item was changed:
----- Method: Character>>isAlphaNumeric (in category 'testing') -----
isAlphaNumeric
"Answer whether the receiver is a letter or a digit."
+ ^self encodedCharSet isAlphaNumeric: self!
- ^self isLetter or: [self isDigit]!
Item was changed:
----- Method: Character>>isDigit (in category 'testing') -----
isDigit
+ ^self encodedCharSet isDigit: self.
- ^ (EncodedCharSet charsetAt: self leadingChar) isDigit: self.
!
Item was changed:
----- Method: Character>>isLetter (in category 'testing') -----
isLetter
+ ^self encodedCharSet isLetter: self.
- ^ (EncodedCharSet charsetAt: self leadingChar) isLetter: self.
!
Item was changed:
----- Method: Character>>isLowercase (in category 'testing') -----
isLowercase
+ ^self encodedCharSet isLowercase: self.
- ^ (EncodedCharSet charsetAt: self leadingChar) isLowercase: self.
!
Item was changed:
----- Method: Character>>isTraditionalDomestic (in category 'testing') -----
isTraditionalDomestic
"Yoshiki's note about #isUnicode says:
[This method] is for the backward compatibility when we had domestic
traditional encodings for CJK languages. To support loading the
projects in traditional domestic encodings (From Nihongo4), and load
some changesets. Once we decided to get rid of classes like JISX0208
from the EncodedCharSet table, the need for isUnicode will not be
necessary.
I (Andreas) decided to change the name from isUnicode to #isTraditionalDomestic
since I found isUnicode to be horribly confusing (how could the character *not*
be Unicode after all?). But still, we should remove this method in due time."
+ ^ (self encodedCharSet isKindOf: LanguageEnvironment class) not!
- ^ ((EncodedCharSet charsetAt: self leadingChar) isKindOf: LanguageEnvironment class) not!
Item was changed:
----- Method: Character>>isUppercase (in category 'testing') -----
isUppercase
+ ^self encodedCharSet isUppercase: self.
- ^ (EncodedCharSet charsetAt: self leadingChar) isUppercase: self.
!
More information about the Squeak-dev
mailing list
|