193 ^ exceptionBlock value. |
193 ^ exceptionBlock value. |
194 ! |
194 ! |
195 |
195 |
196 at:aKey put:anObject |
196 at:aKey put:anObject |
197 "add the argument anObject under key, aKey to the receiver. |
197 "add the argument anObject under key, aKey to the receiver. |
198 |
198 Return anObject (sigh). |
199 WARNING: do not add elements while iterating over the receiver. |
199 WARNING: do not add elements while iterating over the receiver. |
200 Iterate over a copy to do this." |
200 Iterate over a copy to do this." |
201 |
201 |
202 |index "{ Class: SmallInteger }" | |
202 |index "{ Class: SmallInteger }" | |
203 |
203 |
204 aKey isNil ifTrue:[ |
204 aKey isNil ifTrue:[ |
205 "nil is not allowed as key" |
205 "nil is not allowed as key" |
206 self errorInvalidKey:aKey |
206 self errorInvalidKey:aKey |
207 ] ifFalse:[ |
207 ] ifFalse:[ |
208 index := self findKeyOrNil:aKey. |
208 index := self findKeyOrNil:aKey. |
209 (valueArray basicAt:index) notNil ifTrue:[ |
209 (valueArray basicAt:index) notNil ifTrue:[ |
210 valueArray basicAt:index put:anObject. |
210 valueArray basicAt:index put:anObject. |
211 ^ anObject |
211 ^ anObject |
212 ]. |
212 ]. |
213 keyArray basicAt:index put:aKey. |
213 keyArray basicAt:index put:aKey. |
214 valueArray basicAt:index put:anObject. |
214 valueArray basicAt:index put:anObject. |
215 tally := tally + 1. |
215 tally := tally + 1. |
216 |
216 |
217 self fullCheck. |
217 self fullCheck. |
218 ]. |
218 ]. |
219 ^ anObject |
219 ^ anObject |
220 |
220 |
221 "Modified: 1.3.1996 / 21:24:13 / cg" |
221 "Modified: 19.4.1996 / 11:19:45 / cg" |
222 ! |
222 ! |
223 |
223 |
224 keyAtEqualValue:aValue |
224 keyAtEqualValue:aValue |
225 "return the key whose value is equal (i.e. using #= for compare) |
225 "return the key whose value is equal (i.e. using #= for compare) |
226 to the argument, nil if none found. |
226 to the argument, nil if none found. |