The Inbox: Collections-cbc.812.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Collections-cbc.812.mcz

commits-2
A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-cbc.812.mcz

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

Name: Collections-cbc.812
Author: cbc
Time: 15 November 2018, 10:06:05.244237 pm
UUID: 1977358c-ec82-5442-8f1d-027d4bc817a3
Ancestors: Collections-eem.811

Make intervals that are #= have the same hash.
Also, slight adjustment to #=.

=============== Diff against Collections-eem.811 ===============

Item was changed:
  ----- Method: Interval>>= (in category 'comparing') -----
  = anObject
-
  ^ self == anObject
+ or: [anObject isInterval
+ ifFalse: [super = anObject]
+ ifTrue:
+ [start = anObject first
+ and: [step = anObject increment
+ and: [self last = anObject last]]]]!
- ifTrue: [true]
- ifFalse: [anObject isInterval
- ifTrue: [start = anObject first
- and: [step = anObject increment
- and: [self last = anObject last]]]
- ifFalse: [super = anObject]]!

Item was changed:
  ----- Method: Interval>>hash (in category 'comparing') -----
  hash
  "Hash is reimplemented because = is implemented."
 
  ^(((start hash bitShift: 2)
+ bitOr: self last hash)
- bitOr: stop hash)
  bitShift: 1)
  bitOr: self size!