equal
deleted
inserted
replaced
8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
12 |
|
13 "{ Package: 'stx:libbasic2' }" |
|
14 |
13 Collection subclass:#MappedCollection |
15 Collection subclass:#MappedCollection |
14 instanceVariableNames:'domain map' |
16 instanceVariableNames:'domain map' |
15 classVariableNames:'' |
17 classVariableNames:'' |
16 poolDictionaries:'' |
18 poolDictionaries:'' |
17 category:'Collections-Sequenceable' |
19 category:'Collections-Sequenceable' |
18 ! |
20 ! |
19 |
21 |
20 !MappedCollection class methodsFor:'documentation'! |
22 !MappedCollection class methodsFor:'documentation'! |
21 |
23 |
22 copyright |
24 copyright |
23 " |
25 " |
24 COPYRIGHT (c) 1993 by Claus Gittinger |
26 COPYRIGHT (c) 1993 by Claus Gittinger |
25 All Rights Reserved |
27 All Rights Reserved |
44 [author:] |
46 [author:] |
45 Claus Gittinger |
47 Claus Gittinger |
46 " |
48 " |
47 ! ! |
49 ! ! |
48 |
50 |
49 !MappedCollection class methodsFor:'instance creation'! |
51 !MappedCollection class methodsFor:'instance creation'! |
50 |
52 |
51 collection:domainCollection map:mapCollection |
53 collection:domainCollection map:mapCollection |
52 "return a new MappedCollection" |
54 "return a new MappedCollection" |
53 |
55 |
54 ^ super new setCollection:domainCollection map:mapCollection |
56 ^ super new setCollection:domainCollection map:mapCollection |
59 |
61 |
60 self error:'use collection:map: to create a MappedCollection' |
62 self error:'use collection:map: to create a MappedCollection' |
61 ! ! |
63 ! ! |
62 |
64 |
63 !MappedCollection methodsFor:'accessing'! |
65 !MappedCollection methodsFor:'accessing'! |
64 |
|
65 add:anObject |
|
66 "report an error; mappedCollections cannot add elements (without a key)" |
|
67 |
|
68 self shouldNotImplement |
|
69 |
|
70 "Modified: 2.8.1996 / 21:03:57 / cg" |
|
71 ! |
|
72 |
66 |
73 at:key |
67 at:key |
74 "retrieve an element" |
68 "retrieve an element" |
75 |
69 |
76 ^ domain at:(map at:key) |
70 ^ domain at:(map at:key) |
93 contents := Bag new. |
87 contents := Bag new. |
94 map do:[:key | contents add:(domain at:key)]. |
88 map do:[:key | contents add:(domain at:key)]. |
95 ^ contents |
89 ^ contents |
96 |
90 |
97 "Modified: 2.8.1996 / 21:04:10 / cg" |
91 "Modified: 2.8.1996 / 21:04:10 / cg" |
|
92 ! ! |
|
93 |
|
94 !MappedCollection methodsFor:'adding & removing'! |
|
95 |
|
96 add:anObject |
|
97 "report an error; mappedCollections cannot add elements (without a key)" |
|
98 |
|
99 self shouldNotImplement |
|
100 |
|
101 "Modified: 2.8.1996 / 21:03:57 / cg" |
98 ! ! |
102 ! ! |
99 |
103 |
100 !MappedCollection methodsFor:'copying'! |
104 !MappedCollection methodsFor:'copying'! |
101 |
105 |
102 postCopy |
106 postCopy |
155 "return the number of elements in the receiver" |
159 "return the number of elements in the receiver" |
156 |
160 |
157 ^ map size |
161 ^ map size |
158 ! ! |
162 ! ! |
159 |
163 |
160 !MappedCollection class methodsFor:'documentation'! |
164 !MappedCollection class methodsFor:'documentation'! |
161 |
165 |
162 version |
166 version |
163 ^ '$Header: /cvs/stx/stx/libbasic2/MappedCollection.st,v 1.16 1996-08-02 19:04:21 cg Exp $' |
167 ^ '$Header: /cvs/stx/stx/libbasic2/MappedCollection.st,v 1.17 2000-08-22 13:48:33 cg Exp $' |
164 ! ! |
168 ! ! |