The Trunk: Collections-ul.750.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-ul.750.mcz

commits-2
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.750.mcz

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

Name: Collections-ul.750
Author: ul
Time: 24 April 2017, 3:36:04.668235 pm
UUID: 766fe870-89dd-455b-b0e9-8b14c7ab8548
Ancestors: Collections-ul.749

SequenceableCollection changes:
- #indexOfSubCollection:startingAt:ifAbsent: sends indexOfSubCollection:startingAt:
- fix: #identityIndexOf:startingAt:ifAbsent: didn't use startIndex

=============== Diff against Collections-ul.749 ===============

Item was changed:
  ----- Method: SequenceableCollection>>identityIndexOf:startingAt:ifAbsent: (in category 'accessing') -----
  identityIndexOf: anElement startingAt: startIndex ifAbsent: exceptionBlock
  "Answer the index of anElement within the receiver starting at startIndex.
  If the receiver does not contain anElement, answer the result of evaluating
  the argument, exceptionBlock."
 
  | index |
+ (index := self identityIndexOf: anElement startingAt: startIndex) = 0 ifFalse: [ ^index ].
- (index := self identityIndexOf: anElement startingAt: 1) = 0 ifFalse: [ ^index ].
  ^exceptionBlock value!

Item was changed:
  ----- Method: SequenceableCollection>>indexOfSubCollection:startingAt:ifAbsent: (in category 'accessing') -----
  indexOfSubCollection: sub startingAt: start ifAbsent: exceptionBlock
  "Answer the index of the receiver's first element, such that that element
  equals the first element of sub, and the next elements equal
  the rest of the elements of sub. Begin the search at element
  start of the receiver. If no such match is found, answer the result of
  evaluating argument, exceptionBlock."
+
+ | index |
+ (index := self indexOfSubCollection: sub startingAt: start) = 0 ifFalse: [ ^index ].
- | first index |
- sub isEmpty ifTrue: [^ exceptionBlock value].
- first := sub first.
- (start max: 1) to: self size - sub size + 1 do:
- [:startIndex |
- (self at: startIndex) = first ifTrue:
- [index := 1.
- [(self at: startIndex+index-1) = (sub at: index)]
- whileTrue:
- [index = sub size ifTrue: [^startIndex].
- index := index+1]]].
  ^ exceptionBlock value!