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

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

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

Name: Collections-ul.735
Author: ul
Time: 25 February 2017, 11:13:28.853237 pm
UUID: 69162a09-6a34-44b2-9a07-5a43e2020df6
Ancestors: Collections-eem.734, Collections-tonyg.733.1

- merged Collections-tonyg.733.1
- Character >> #isSeparator's old version's big comeback with improved comment and performance (25% faster on cog_linux64x64_squeak.cog.spur_201702211732).

=============== Diff against Collections-eem.734 ===============

Item was changed:
  ----- Method: Character>>isSeparator (in category 'testing') -----
  isSeparator
  "Answer whether the receiver is one of the separator characters--space,
  cr, tab, line feed, or form feed."
 
  | integerValue |
+ (integerValue := self asInteger) > 32 ifTrue: [ ^false ].
+ integerValue
+ caseOf: {
+ [ 32 "space" ] -> [ ^true ].
+ [ 9 "tab" ] -> [ ^true ].
+ [ 13 "cr"] -> [ ^true ].
+ [ 10 "line feed" ] -> [ ^true ].
+ [ 12 "form feed"] -> [ ^true ] }
+ otherwise: [ ^false  ]!
- (integerValue := self asInteger) > 32 ifTrue: [^false].
- ^#(false false false false false false false false false
- true "9 = tab"
- true "10 = line feed"
- false
- true "12 = form feed"
- true "13 = cr"
- false false false false false false false false false false false false false false false false false false
- true) at: integerValue + 1!

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."
  | first index |
  sub isEmpty ifTrue: [^ exceptionBlock value].
  first := sub first.
+ (start max: 1) to: self size - sub size + 1 do:
- start 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!