David T. Lewis uploaded a new version of Chronology-Tests to project The Trunk:
http://source.squeak.org/trunk/Chronology-Tests-dtl.6.mcz
==================== Summary ====================
Name: Chronology-Tests-dtl.6
Author: dtl
Time: 4 December 2016, 11:48:31.846968 am
UUID: ec13423f-cc05-4d51-a5be-675cb70c8d7f
Ancestors: Chronology-Tests-dtl.5
Three new tests to verify that #asSeconds is symmetric with #fromSeconds: with various offset values. The tests pass.
=============== Diff against Chronology-Tests-dtl.5 ===============
Item was added:
+ ----- Method: DateAndTimeTest>>testAsSecondsMatchesFromSecondsUsingAnyOffset (in category 'Tests') -----
+ testAsSecondsMatchesFromSecondsUsingAnyOffset
+ "Verify that #asSeconds is symmetric with #fromSeconds: for an instance with
+ offset that does not match the current local time zone offset."
+
+ | aDateAndTime seconds newDateAndTime |
+ aDateAndTime := DateAndTime year: 2004 month: 2 day: 29 hour: 13 minute: 33 second: 0 offset: 2 hours.
+ seconds := aDateAndTime asSeconds.
+ newDateAndTime := DateAndTime fromSeconds: seconds.
+ self assert: seconds equals: newDateAndTime asSeconds.
+
+ "Repeat with another offset to ensure coverage"
+ aDateAndTime := DateAndTime year: 2004 month: 2 day: 29 hour: 13 minute: 33 second: 0 offset: -11 hours.
+ seconds := aDateAndTime asSeconds.
+ newDateAndTime := DateAndTime fromSeconds: seconds.
+ self assert: seconds equals: newDateAndTime asSeconds.
+ !
Item was added:
+ ----- Method: DateAndTimeTest>>testAsSecondsMatchesFromSecondsUsingCurrentLocalOffset (in category 'Tests') -----
+ testAsSecondsMatchesFromSecondsUsingCurrentLocalOffset
+ "Verify that #asSeconds is symmetric with #fromSeconds: for an instance with
+ offset that matches the current local time zone offset."
+
+ | seconds newDateAndTime now |
+ now := DateAndTime now.
+ seconds := now asSeconds.
+ newDateAndTime := DateAndTime fromSeconds: seconds.
+ self assert: seconds equals: newDateAndTime asSeconds.
+ !
Item was added:
+ ----- Method: DateAndTimeTest>>testAsSecondsMatchesFromSecondsUsingZeroOffset (in category 'Tests') -----
+ testAsSecondsMatchesFromSecondsUsingZeroOffset
+ "Verify that #asSeconds is symmetric with #fromSeconds: for an instance with
+ zero offset as in UTC time."
+
+ | aDateAndTime seconds newDateAndTime |
+ aDateAndTime := DateAndTime year: 2004 month: 2 day: 29 hour: 13 minute: 33 second: 0 offset: 0 hours.
+ seconds := aDateAndTime asSeconds.
+ newDateAndTime := DateAndTime fromSeconds: seconds.
+ self assert: seconds equals: newDateAndTime asSeconds.
+ !
David T. Lewis uploaded a new version of Chronology-Tests to project The Trunk:
http://source.squeak.org/trunk/Chronology-Tests-dtl.5.mcz
==================== Summary ====================
Name: Chronology-Tests-dtl.5
Author: dtl
Time: 4 December 2016, 10:38:28.08545 am
UUID: 4f5040e9-e8f0-4937-b978-db3e0ae7ce24
Ancestors: Chronology-Tests-pre.4
The correct number of elapsed seconds from the Smalltalk epoch to 2004-02-29T13:33:00+02:00 is 3255507180. Change DateAndTime>>testAsSeconds to assert this value.
=============== Diff against Chronology-Tests-pre.4 ===============
Item was changed:
----- Method: DateAndTimeLeapTest>>testAsSeconds (in category 'testing') -----
testAsSeconds
self assert: aDuration asSeconds = 48780.
+ self assert: aDateAndTime asSeconds = 3255507180!
- self assert: aDateAndTime asSeconds = 3255514380!
Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.920.mcz
==================== Summary ====================
Name: System-eem.920
Author: eem
Time: 3 December 2016, 9:33:47.096323 am
UUID: 694cd18b-4572-4762-b5b9-29e116119a9d
Ancestors: System-bf.919
The various scanFor: and scanForEmptySlotFor: implementations only need to access the size of their array once.
=============== Diff against System-bf.919 ===============
Item was changed:
----- Method: SystemDictionary>>scanFor: (in category 'private') -----
scanFor: anObject
"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject hash \\ (size := array size) + 1.
- | index start |
- index := start := anObject hash \\ array size + 1.
[
| element |
((element := array at: index) == nil or: [ element key == anObject ])
ifTrue: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: SystemDictionary>>scanForEmptySlotFor: (in category 'private') -----
scanForEmptySlotFor: anObject
"Scan the key array for the first slot containing an empty slot (indicated by a nil). Answer the index of that slot. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject hash \\ (size := array size) + 1.
- | index start |
- index := start := anObject hash \\ array size + 1.
[
(array at: index) ifNil: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1050.mcz
==================== Summary ====================
Name: Kernel-eem.1050
Author: eem
Time: 3 December 2016, 9:32:37.361263 am
UUID: 57843650-49e3-4f32-a54b-026878128dc2
Ancestors: Kernel-cmm.1049
The various scanFor: and scanForEmptySlotFor: implementations only need to access the size of their array once.
=============== Diff against Kernel-cmm.1049 ===============
Item was changed:
----- Method: MethodDictionary>>scanFor: (in category 'private') -----
scanFor: anObject
"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject identityHash \\ (size := array size) + 1.
- | index start |
- index := start := anObject identityHash \\ array size + 1.
[
| element |
((element := self basicAt: index) == nil or: [ element == anObject ])
ifTrue: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.724.mcz
==================== Summary ====================
Name: Collections-eem.724
Author: eem
Time: 3 December 2016, 9:30:36.13835 am
UUID: 83cb6b85-2b47-4c92-a953-e3787a19d53b
Ancestors: Collections-eem.723
The various scanFor: and scanForEmptySlotFor: implementations only need to access the size of their array once.
Fix protocol for an #=
=============== Diff against Collections-eem.723 ===============
Item was changed:
----- Method: Dictionary>>scanFor: (in category 'private') -----
scanFor: anObject
"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject hash \\ (size := array size) + 1.
- | index start |
- index := start := anObject hash \\ array size + 1.
[
| element |
((element := array at: index) == nil or: [ anObject = element key ])
ifTrue: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: HashedCollection>>scanForEmptySlotFor: (in category 'private') -----
scanForEmptySlotFor: anObject
"Scan the key array for the first slot containing an empty slot (indicated by a nil). Answer the index of that slot. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject hash \\ (size := array size) + 1.
- | index start |
- index := start := anObject hash \\ array size + 1.
[
(array at: index) ifNil: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: IdentityDictionary>>scanFor: (in category 'private') -----
scanFor: anObject
"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject scaledIdentityHash \\ (size := array size) + 1.
- | index start |
- index := start := anObject scaledIdentityHash \\ array size + 1.
[
| element |
((element := array at: index) == nil or: [ element key == anObject ])
ifTrue: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: IdentityDictionary>>scanForEmptySlotFor: (in category 'private') -----
scanForEmptySlotFor: anObject
"Scan the key array for the first slot containing an empty slot (indicated by a nil). Answer the index of that slot. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject scaledIdentityHash \\ (size := array size) + 1.
- | index start |
- index := start := anObject scaledIdentityHash \\ array size + 1.
[
(array at: index) ifNil: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: IdentitySet>>scanFor: (in category 'private') -----
scanFor: anObject
"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject scaledIdentityHash \\ (size := array size) + 1.
- | index start |
- index := start := anObject scaledIdentityHash \\ array size + 1.
[
| element |
((element := array at: index) == nil or: [ element enclosedSetElement == anObject ])
ifTrue: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: IdentitySet>>scanForEmptySlotFor: (in category 'private') -----
scanForEmptySlotFor: anObject
"Scan the key array for the first slot containing an empty slot (indicated by a nil). Answer the index of that slot. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject scaledIdentityHash \\ (size := array size) + 1.
- | index start |
- index := start := anObject scaledIdentityHash \\ array size + 1.
[
(array at: index) ifNil: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: KeyedIdentitySet>>scanFor: (in category 'private') -----
scanFor: anObject
"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject scaledIdentityHash \\ (size := array size) + 1.
- | index start |
- index := start := anObject scaledIdentityHash \\ array size + 1.
[
| element |
((element := array at: index) == nil or: [ (keyBlock value: element enclosedSetElement) == anObject ])
ifTrue: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: KeyedIdentitySet>>scanForEmptySlotFor: (in category 'private') -----
scanForEmptySlotFor: anObject
"Scan the key array for the first slot containing an empty slot (indicated by a nil). Answer the index of that slot. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject scaledIdentityHash \\ (size := array size) + 1.
- | index start |
- index := start := anObject scaledIdentityHash \\ array size + 1.
[
(array at: index) ifNil: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: KeyedSet>>scanFor: (in category 'private') -----
scanFor: anObject
"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject hash \\ (size := array size) + 1.
- | index start |
- index := start := anObject hash \\ array size + 1.
[
| element |
((element := array at: index) == nil or: [ (keyBlock value: element enclosedSetElement) = anObject ])
ifTrue: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: PluggableDictionary>>scanFor: (in category 'private') -----
scanFor: anObject
"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
- | index start |
index := start := (hashBlock
ifNil: [ anObject hash ]
+ ifNotNil: [ hashBlock value: anObject ]) \\ (size := array size) + 1.
- ifNotNil: [ hashBlock value: anObject ]) \\ array size + 1.
[
| element |
((element := array at: index) == nil or: [
equalBlock
ifNil: [ element key = anObject ]
ifNotNil: [ equalBlock value: element key value: anObject ] ])
ifTrue: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: PluggableDictionary>>scanForEmptySlotFor: (in category 'private') -----
scanForEmptySlotFor: anObject
"Scan the key array for the first slot containing an empty slot (indicated by a nil). Answer the index of that slot. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
- | index start |
index := start := (hashBlock
ifNil: [ anObject hash ]
+ ifNotNil: [ hashBlock value: anObject ]) \\ (size := array size) + 1.
- ifNotNil: [ hashBlock value: anObject ]) \\ array size + 1.
[
(array at: index) ifNil: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
+ ----- Method: PluggableSet>>= (in category 'comparing') -----
- ----- Method: PluggableSet>>= (in category 'as yet unclassified') -----
= anObject
"Two sets are equal if
(a) they are the same 'kind' of thing.
(b) they have the same set of keys.
(c) for each (common) key, they have the same value"
self == anObject ifTrue: [ ^true ].
self species == anObject species ifFalse: [ ^false ].
hashBlock = anObject hashBlock ifFalse: [ ^false ].
equalBlock = anObject equalBlock ifFalse: [ ^false ].
self size = anObject size ifFalse: [ ^false ].
^self allSatisfy: [ :each | anObject includes: each ]!
Item was changed:
----- Method: PluggableSet>>scanFor: (in category 'private') -----
scanFor: anObject
"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
- | index start |
index := start := (hashBlock
ifNil: [ anObject hash ]
+ ifNotNil: [ hashBlock value: anObject ]) \\ (size := array size) + 1.
- ifNotNil: [ hashBlock value: anObject ]) \\ array size + 1.
[
| element |
((element := array at: index) == nil or: [
equalBlock
ifNil: [ element enclosedSetElement = anObject ]
ifNotNil: [ equalBlock value: element enclosedSetElement value: anObject ] ])
ifTrue: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: PluggableSet>>scanForEmptySlotFor: (in category 'private') -----
scanForEmptySlotFor: anObject
"Scan the key array for the first slot containing an empty slot (indicated by a nil). Answer the index of that slot. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
- | index start |
index := start := (hashBlock
ifNil: [ anObject hash ]
+ ifNotNil: [ hashBlock value: anObject ]) \\ (size := array size) + 1.
- ifNotNil: [ hashBlock value: anObject ]) \\ array size + 1.
[
(array at: index) ifNil: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: Set>>scanFor: (in category 'private') -----
scanFor: anObject
"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject hash \\ (size := array size) + 1.
- | index start |
- index := start := anObject hash \\ array size + 1.
[
| element |
((element := array at: index) == nil or: [ anObject = element enclosedSetElement ])
ifTrue: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: WeakIdentityKeyDictionary>>scanFor: (in category 'private') -----
scanFor: anObject
"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject scaledIdentityHash \\ (size := array size) + 1.
- | index start |
- index := start := anObject scaledIdentityHash \\ array size + 1.
[
| element |
((element := array at: index) == nil or: [ element key == anObject ])
ifTrue: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: WeakIdentityKeyDictionary>>scanForEmptySlotFor: (in category 'private') -----
scanForEmptySlotFor: anObject
"Scan the key array for the first slot containing an empty slot (indicated by a nil). Answer the index of that slot. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject scaledIdentityHash \\ (size := array size) + 1.
- | index start |
- index := start := anObject scaledIdentityHash \\ array size + 1.
[
(array at: index) ifNil: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: WeakSet>>scanFor: (in category 'private') -----
scanFor: anObject
"Scan the key array for the first slot containing either flag (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject hash \\ (size := array size) + 1.
- | index start |
- index := start := anObject hash \\ array size + 1.
[
| element |
((element := array at: index) == flag or: [ element enclosedSetElement = anObject ])
ifTrue: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!
Item was changed:
----- Method: WeakSet>>scanForEmptySlotFor: (in category 'private') -----
scanForEmptySlotFor: anObject
"Scan the key array for the first slot containing an empty slot (indicated by flag or a nil). Answer the index of that slot. This method will be overridden in various subclasses that have different interpretations for matching elements."
+ | index start size |
+ index := start := anObject hash \\ (size := array size) + 1.
- | index start |
- index := start := anObject hash \\ array size + 1.
[
| element |
((element := array at: index) == flag or: [ element == nil ]) ifTrue: [ ^index ].
+ (index := index \\ size + 1) = start ] whileFalse.
- (index := index \\ array size + 1) = start ] whileFalse.
self errorNoFreeSpace!