--- a/CharacterArray.st Fri Mar 25 06:29:08 2016 +0000
+++ b/CharacterArray.st Sat Mar 26 07:56:10 2016 +0000
@@ -755,7 +755,7 @@
isAbstract
"Return if this class is an abstract class.
True is returned for CharacterArray here; false for subclasses.
- Abstract subclasses must redefine again."
+ Abstract subclasses must redefine this again."
^ self == CharacterArray
!
@@ -3241,7 +3241,8 @@
!
asMutator
- "return a corresponding setter method's selector"
+ "return a corresponding setter method's selector.
+ I.e. #foo asMutator returns #foo:"
^ (self asOneByteString,':') asSymbol
!
@@ -3763,7 +3764,7 @@
!
chopTo:maxLen
- "if the receivers size is less or equal to maxLen, return it.
+ "if the receiver's size is less or equal to maxLen, return it.
Otherwise, return a copy of the receiver, where some characters
in the middle have been removed for a total string length
of maxLen."
@@ -3774,7 +3775,7 @@
n1 := n2 := maxLen // 2.
maxLen odd ifTrue:[
- n2 := n1 + 1
+ n2 := n1 + 1
].
^ (self copyFrom:1 to:n1) , (self copyFrom:sz - n2 + 1)
@@ -3790,7 +3791,7 @@
!
contractAtBeginningTo:maxLen
- "if the receivers size is less or equal to maxLen, return it.
+ "if the receiver's size is less or equal to maxLen, return it.
Otherwise, return a copy of the receiver, where some characters
at the beginning have been replaced by '...' for a total string length
of maxLen. Can be used to abbreviate long entries in tables."
@@ -3813,7 +3814,7 @@
!
contractAtEndTo:maxLen
- "if the receivers size is less or equal to maxLen, return it.
+ "if the receiver's size is less or equal to maxLen, return it.
Otherwise, return a copy of the receiver, where some characters
at the end have been replaced by '...' for a total string length
of maxLen. Can be used to abbreviate long entries in tables."
@@ -3836,7 +3837,7 @@
!
contractLeftTo:maxLen
- "if the receivers size is less or equal to maxLen, return it.
+ "if the receiver's size is less or equal to maxLen, return it.
Otherwise, return a copy of the receiver, where some characters
near the first quarter have been replaced by '...' for a total string length
of maxLen.
@@ -3867,7 +3868,7 @@
!
contractTo:maxLen
- "if the receivers size is less or equal to maxLen, return it.
+ "if the receiver's size is less or equal to maxLen, return it.
Otherwise, return a copy of the receiver, where some characters
in the middle have been replaced by '...' for a total string length
of maxLen. Can be used to abbreviate long entries in tables."
@@ -3950,7 +3951,7 @@
!
copyWith:aCharacter
- "return a new string containing the receivers characters
+ "return a new string containing the receiver's characters
and the single new character, aCharacter.
This is different from concatentation, which expects another string
as argument, but equivalent to copy-and-addLast.
@@ -3960,11 +3961,11 @@
|sz newString|
aCharacter bitsPerCharacter > self bitsPerCharacter ifTrue:[
- sz := self size.
- newString := aCharacter stringSpecies new:sz + 1.
- newString replaceFrom:1 to:sz with:self startingAt:1.
- newString at:sz+1 put:aCharacter.
- ^ newString.
+ sz := self size.
+ newString := aCharacter stringSpecies new:sz + 1.
+ newString replaceFrom:1 to:sz with:self startingAt:1.
+ newString at:sz+1 put:aCharacter.
+ ^ newString.
].
^ super copyWith:aCharacter
!
@@ -5163,11 +5164,11 @@
!CharacterArray methodsFor:'padded copying'!
centerPaddedTo:newSize
- "return a new string consisting of the receivers characters,
- plus spaces up to length and center the receivers characters in
- the resulting string.
- If the receivers size is equal or greater than the length argument,
- the original receiver is returned unchanged."
+ "return a new string consisting of the receiver's characters,
+ plus spaces up to length and center the receiver's characters in
+ the resulting string.
+ If the receiver's size is equal or greater than the length argument,
+ the original receiver is returned unchanged."
^ self centerPaddedTo:newSize with:(Character space)
@@ -5183,16 +5184,16 @@
"return a new string of length size, which contains the receiver
centered (i.e. padded on both sides).
Characters are filled with padCharacter.
- If the receivers size is equal or greater than the length argument,
+ If the receiver's size is equal or greater than the length argument,
the original receiver is returned unchanged."
|len s|
len := self size.
(len < size) ifTrue:[
- s := self species new:size withAll:padCharacter.
- s replaceFrom:(size - len) // 2 + 1 with:self.
- ^ s
+ s := self species new:size withAll:padCharacter.
+ s replaceFrom:(size - len) // 2 + 1 with:self.
+ ^ s
]
"
@@ -5211,16 +5212,16 @@
aligned at the decimal-period column and afterPeriod characters to the right
of the period. The periodCharacter is passed as arguments (allowing for US and European formats
to be padded).
- If the receivers size is equal or greater than the length argument,
+ If the receiver's size is equal or greater than the length argument,
the original receiver is returned unchanged.
(sounds complicated ? -> see examples below)."
^ self
- decimalPaddedTo:size
- and:afterPeriod
- at:decimalCharacter
- withLeft:(Character space)
- right:$0
+ decimalPaddedTo:size
+ and:afterPeriod
+ at:decimalCharacter
+ withLeft:(Character space)
+ right:$0
"
'123' decimalPaddedTo:10 and:3 at:$. -> ' 123 '
@@ -5241,7 +5242,7 @@
Characters on the left are filled with leftPadChar.
If rightPadChar is nil, characters on the right are filled with leftPadCharacter too;
otherwise, if missing, a decimal point is added and right characters filled with this.
- If the receivers size is equal or greater than the length argument,
+ If the receiver's size is equal or greater than the length argument,
the original receiver is returned unchanged.
(sounds complicated ? -> see examples below)."
@@ -5249,25 +5250,25 @@
idx := self indexOf:decimalCharacter.
idx == 0 ifTrue:[
- "/
- "/ no decimal point found; adjust string to the left of the period column
- "/
- rightPadChar isNil ifTrue:[
- s := self , (self species new:afterPeriod + 1 withAll:leftPadChar)
- ] ifFalse:[
- s:= self , decimalCharacter asString , (self species new:afterPeriod withAll:rightPadChar).
- ].
+ "/
+ "/ no decimal point found; adjust string to the left of the period column
+ "/
+ rightPadChar isNil ifTrue:[
+ s := self , (self species new:afterPeriod + 1 withAll:leftPadChar)
+ ] ifFalse:[
+ s:= self , decimalCharacter asString , (self species new:afterPeriod withAll:rightPadChar).
+ ].
] ifFalse:[
- "/ the number of after-decimalPoint characters
- n := self size - idx.
- rest := afterPeriod - n.
- rest > 0 ifTrue:[
- s := (self species new:rest withAll:(rightPadChar ? leftPadChar)).
- ] ifFalse:[
- s := ''
- ].
- s := self , s.
+ "/ the number of after-decimalPoint characters
+ n := self size - idx.
+ rest := afterPeriod - n.
+ rest > 0 ifTrue:[
+ s := (self species new:rest withAll:(rightPadChar ? leftPadChar)).
+ ] ifFalse:[
+ s := ''
+ ].
+ s := self , s.
].
^ s leftPaddedTo:size with:leftPadChar
@@ -5288,7 +5289,7 @@
"return a new string of length size, which contains the receiver
right-adjusted (i.e. padded on the left).
Characters on the left are filled with spaces.
- If the receivers size is equal or greater than the length argument,
+ If the receiver's size is equal or greater than the length argument,
the original receiver is returned unchanged."
^ self leftPaddedTo:size with:(Character space)
@@ -5303,7 +5304,7 @@
paddedTo:newSize
"return a new string consisting of the receivers characters,
plus spaces up to length.
- If the receivers size is equal or greater than the length argument,
+ If the receiver's size is equal or greater than the length argument,
the original receiver is returned unchanged."
^ self paddedTo:newSize with:(Character space)
@@ -5655,7 +5656,7 @@
!
heightOn:aGC
- "return the size of the recevier in device units if displayed on aGC"
+ "return the size of the receiver in device units if displayed on aGC"
^ (aGC font onDevice:aGC device) heightOf:self
@@ -5741,7 +5742,7 @@
leftIndent
"if the receiver starts with spaces, return the number of spaces
at the left - otherwise, return 0.
- If the receiver consists of spaces only, return the receivers size."
+ If the receiver consists of spaces only, return the receiver's size."
|index "{Class: SmallInteger }"
end "{Class: SmallInteger }"|
@@ -5749,8 +5750,8 @@
index := 1.
end := self size.
[index <= end] whileTrue:[
- (self at:index) isSeparator ifFalse:[^ index - 1].
- index := index + 1
+ (self at:index) isSeparator ifFalse:[^ index - 1].
+ index := index + 1
].
^ end
@@ -5812,7 +5813,7 @@
!
widthFrom:startIndex to:endIndex on:aGC
- "return ths size of part of the recevier in device units if displayed on aGC"
+ "return ths size of part of the receiver in device units if displayed on aGC"
^ (aGC font onDevice:aGC device) widthOf:self from:startIndex to:endIndex
@@ -5823,7 +5824,7 @@
!
widthOn:aGC
- "return ths size of the recevier in device units if displayed on aGC"
+ "return ths size of the receiver in device units if displayed on aGC"
^ (aGC font onDevice:aGC device) widthOf:self
@@ -6386,13 +6387,13 @@
!
withTabs
- "return a string consisting of the receivers characters
+ "return a string consisting of the receiver's characters
where leading spaces are replaced by tabulator characters (assuming 8-col tabs).
Notice: if the receiver does not contain any tabs, it is returned unchanged;
otherwise a new string is returned.
Limitation: only the very first spaces are replaced
- (i.e. if the receiver contains newLine characters,
- no tabs are inserted after those lineBreaks)"
+ (i.e. if the receiver contains newLine characters,
+ no tabs are inserted after those lineBreaks)"
|idx "{ SmallInteger }"
nTabs "{ SmallInteger }"
@@ -6419,7 +6420,7 @@
!
withTabsExpanded
- "return a string consisting of the receivers characters,
+ "return a string consisting of the receiver's characters,
where all tabulator characters are expanded into spaces (assuming 8-col tabs).
Notice: if the receiver does not contain any tabs, it is returned unchanged;
otherwise a new string is returned.
@@ -6436,26 +6437,26 @@
('123456789' , Character tab asString , 'x') withTabsExpanded
(String with:Character tab
- with:Character tab
- with:$1) withTabsExpanded
+ with:Character tab
+ with:$1) withTabsExpanded
(String with:Character tab
- with:$1
- with:Character tab
- with:$2) withTabsExpanded
+ with:$1
+ with:Character tab
+ with:$2) withTabsExpanded
(String with:Character tab
- with:$1
- with:Character cr
- with:Character tab
- with:$2) withTabsExpanded
+ with:$1
+ with:Character cr
+ with:Character tab
+ with:$2) withTabsExpanded
"
"Modified: 12.5.1996 / 13:05:10 / cg"
!
withTabsExpanded:numSpaces
- "return a string consisting of the receivers characters,
+ "return a string consisting of the receiver's characters,
where all tabulator characters are expanded into spaces (assuming numSpaces-col tabs).
Notice: if the receiver does not contain any tabs, it is returned unchanged;
otherwise a new string is returned.
@@ -6477,19 +6478,19 @@
col := 1. newSz := 0.
1 to:sz do:[:srcIdx |
- ch := self at:srcIdx.
- ch == Character tab ifFalse:[
- col := col + 1.
- newSz := newSz + 1.
- ch == Character cr ifTrue:[
- col := 1
- ].
- ] ifTrue:[
- (col \\ numSpaces) to:numSpaces do:[:ii |
- newSz := newSz + 1.
- col := col + 1
- ].
- ]
+ ch := self at:srcIdx.
+ ch == Character tab ifFalse:[
+ col := col + 1.
+ newSz := newSz + 1.
+ ch == Character cr ifTrue:[
+ col := 1
+ ].
+ ] ifTrue:[
+ (col \\ numSpaces) to:numSpaces do:[:ii |
+ newSz := newSz + 1.
+ col := col + 1
+ ].
+ ]
].
self isText ifTrue:[
@@ -6502,26 +6503,26 @@
col := 1. dstIdx := 1.
1 to:sz do:[:srcIdx |
- ch := self at:srcIdx.
-
- ch == Character tab ifFalse:[
- col := col + 1.
- ch == Character cr ifTrue:[
- col := 1
- ].
- hasEmphasis ifTrue:[
- e := self emphasisAt:srcIdx.
- str emphasisAt:dstIdx put:e
- ].
- str at:dstIdx put:ch.
- dstIdx := dstIdx + 1
- ] ifTrue:[
- (col \\ numSpaces) to:numSpaces do:[:ii |
- str at:dstIdx put:Character space.
- dstIdx := dstIdx + 1.
- col := col + 1
- ].
- ]
+ ch := self at:srcIdx.
+
+ ch == Character tab ifFalse:[
+ col := col + 1.
+ ch == Character cr ifTrue:[
+ col := 1
+ ].
+ hasEmphasis ifTrue:[
+ e := self emphasisAt:srcIdx.
+ str emphasisAt:dstIdx put:e
+ ].
+ str at:dstIdx put:ch.
+ dstIdx := dstIdx + 1
+ ] ifTrue:[
+ (col \\ numSpaces) to:numSpaces do:[:ii |
+ str at:dstIdx put:Character space.
+ dstIdx := dstIdx + 1.
+ col := col + 1
+ ].
+ ]
].
^ str
@@ -6535,19 +6536,19 @@
('123456789' , Character tab asString , 'x') withTabsExpanded
(String with:Character tab
- with:Character tab
- with:$1) withTabsExpanded
+ with:Character tab
+ with:$1) withTabsExpanded
(String with:Character tab
- with:$1
- with:Character tab
- with:$2) withTabsExpanded
+ with:$1
+ with:Character tab
+ with:$2) withTabsExpanded
(String with:Character tab
- with:$1
- with:Character cr
- with:Character tab
- with:$2) withTabsExpanded
+ with:$1
+ with:Character cr
+ with:Character tab
+ with:$2) withTabsExpanded
"
"Modified: / 12-05-1996 / 13:05:10 / cg"
@@ -6709,7 +6710,7 @@
!
withoutCRs
- "return a new collection consisting of receivers elements
+ "return a new collection consisting of receiver's elements
with all cr-characters replaced by \-characters.
This is the reverse operation of withCRs."
@@ -7534,19 +7535,19 @@
!
isValidSmalltalkIdentifier
- "return true, if the receivers characters make up a valid smalltalk identifier"
+ "return true, if the receiver's characters make up a valid smalltalk identifier"
|scanner tok|
scanner := Compiler new.
scanner source:(self readStream).
Parser parseErrorSignal handle:[:ex |
- tok := nil.
+ tok := nil.
] do:[
- tok := scanner nextToken.
+ tok := scanner nextToken.
].
tok ~~ #Identifier ifTrue:[
- ^ false
+ ^ false
].
scanner tokenPosition == 1 ifFalse:[^ false].
^ scanner sourceStream atEnd.