class: CharacterArray
class definition
remove unused class vars
changed: #indexOfSubCollection:startingAt:ifAbsent:caseSensitive:
fix stc warnings
--- a/CharacterArray.st Tue Jun 25 22:37:31 2013 +0200
+++ b/CharacterArray.st Wed Jun 26 09:59:54 2013 +0200
@@ -14,7 +14,7 @@
UninterpretedBytes variableByteSubclass:#CharacterArray
instanceVariableNames:''
classVariableNames:'PreviousMatch DecoderTables EncoderTables DecodingFailedSignal
- EncodingFailedSignal LastString LastShiftTable'
+ EncodingFailedSignal'
poolDictionaries:''
category:'Collections-Text'
!
@@ -5991,46 +5991,45 @@
subSize := subString size.
subSize == 0 ifTrue:[
- subString isString ifFalse:[
- self error:'non string argument' mayProceed:true.
- ].
- "empty string does not match"
- ^ 0.
- "empty string matches"
- ^ index
+ subString isString ifFalse:[
+ self error:'non string argument' mayProceed:true.
+ ].
+ "empty string does not match"
+ ^ 0.
+ "empty string matches"
+"/ ^ index
].
- tester := caseSensitive
- ifTrue:[ [:c1 :c2 | c1 = c2 ] ]
- ifFalse:[ [:c1 :c2 | c1 sameAs: c2 ] ].
mySize := self size.
firstChar := subString at:1.
caseSensitive ifTrue:[
- startIndex := self indexOf:firstChar startingAt:index.
+ tester := [:c1 :c2 | c1 = c2 ].
+ startIndex := self indexOf:firstChar startingAt:index.
] ifFalse:[
- startIndex := self findFirst:[:c | c sameAs:firstChar] startingAt:index.
+ tester := [:c1 :c2 | c1 sameAs: c2 ].
+ startIndex := self findFirst:[:c | c sameAs:firstChar] startingAt:index.
].
[startIndex == 0] whileFalse:[
- runIdx := startIndex.
- found := true.
- 1 to:subSize do:[:i |
- runIdx > mySize ifTrue:[
- found := false
- ] ifFalse:[
- (tester value:(subString at:i) value:(self at:runIdx)) ifFalse:[
- found := false
- ]
- ].
- runIdx := runIdx + 1
- ].
- found ifTrue:[
- ^ startIndex
- ].
- caseSensitive ifTrue:[
- startIndex := self indexOf:firstChar startingAt:(startIndex + 1)
- ] ifFalse:[
- startIndex := self findFirst:[:c | c sameAs:firstChar] startingAt:(startIndex + 1).
- ].
+ runIdx := startIndex.
+ found := true.
+ 1 to:subSize do:[:i |
+ runIdx > mySize ifTrue:[
+ found := false
+ ] ifFalse:[
+ (tester value:(subString at:i) value:(self at:runIdx)) ifFalse:[
+ found := false
+ ]
+ ].
+ runIdx := runIdx + 1
+ ].
+ found ifTrue:[
+ ^ startIndex
+ ].
+ caseSensitive ifTrue:[
+ startIndex := self indexOf:firstChar startingAt:(startIndex + 1)
+ ] ifFalse:[
+ startIndex := self findFirst:[:c | c sameAs:firstChar] startingAt:(startIndex + 1).
+ ].
].
^ exceptionBlock value
@@ -6418,11 +6417,11 @@
!CharacterArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.505 2013-06-25 17:41:14 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.506 2013-06-26 07:59:54 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.505 2013-06-25 17:41:14 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.506 2013-06-26 07:59:54 stefan Exp $'
! !