[squeak-dev] The Inbox: Collections-mt.932.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Mar 26 18:05:00 UTC 2021
A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-mt.932.mcz
==================== Summary ====================
Name: Collections-mt.932
Author: mt
Time: 26 March 2021, 7:04:57.368373 pm
UUID: b6c0c2c9-0a4f-684c-87a7-069813edd154
Ancestors: Collections-dtl.931
Sketch of a dictionary that has collections as values.
dict := CollectionsDictionary new.
(dict at: #fruits) addAll: #(apple apple peach).
(dict at: #sweets) add: #nougat.
dict removeKey: #sweets.
dict explore.
=============== Diff against Collections-dtl.931 ===============
Item was added:
+ Dictionary subclass: #CollectionsDictionary
+ instanceVariableNames: 'collectionClass'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Collections-Unordered'!
Item was added:
+ ----- Method: CollectionsDictionary class>>defaultCollectionClass (in category 'defaults') -----
+ defaultCollectionClass
+
+ ^ OrderedCollection!
Item was added:
+ ----- Method: CollectionsDictionary class>>newOnBags (in category 'instance creation') -----
+ newOnBags
+
+ ^ self new
+ setCollectionClass: Bag;
+ yourself!
Item was added:
+ ----- Method: CollectionsDictionary class>>newOnOrderedCollections (in category 'instance creation') -----
+ newOnOrderedCollections
+
+ ^ self new
+ setCollectionClass: OrderedCollection;
+ yourself!
Item was added:
+ ----- Method: CollectionsDictionary class>>newOnSets (in category 'instance creation') -----
+ newOnSets
+
+ ^ self new
+ setCollectionClass: Set;
+ yourself!
Item was added:
+ ----- Method: CollectionsDictionary>>at: (in category 'accessing') -----
+ at: key
+
+ ^ self at: key ifAbsent: [super at: key put: collectionClass new]!
Item was added:
+ ----- Method: CollectionsDictionary>>at:put: (in category 'accessing') -----
+ at: key put: value
+
+ self shouldNotImplement.!
Item was added:
+ ----- Method: CollectionsDictionary>>collectionClass (in category 'accessing') -----
+ collectionClass
+
+ ^ collectionClass!
Item was added:
+ ----- Method: CollectionsDictionary>>initialize: (in category 'initialization') -----
+ initialize: n
+
+ super initialize: n.
+ self setCollectionClass: self class defaultCollectionClass.!
Item was added:
+ ----- Method: CollectionsDictionary>>setCollectionClass: (in category 'initialization') -----
+ setCollectionClass: aClass
+
+ collectionClass := aClass.!
More information about the Squeak-dev
mailing list
|