Collection.st
changeset 3381 e1c12fa92fbf
parent 3367 9510bc82d4d6
child 3402 d24e9629cdfb
--- a/Collection.st	Sun Apr 19 20:09:19 1998 +0200
+++ b/Collection.st	Sun Apr 19 20:11:05 1998 +0200
@@ -855,6 +855,15 @@
 
 !Collection methodsFor:'copying'!
 
+copy
+    "return a copy of the receiver.
+     Redefined to pass the original as argument to tyhe postCopyFrom method."
+
+    ^ self shallowCopy postCopyFrom:self
+
+    "Created: / 19.4.1998 / 20:02:53 / cg"
+!
+
 copyEmpty
     "return a copy of the receiver with no elements.
      This is used by copying and enumeration methods
@@ -881,6 +890,19 @@
      to get a new instance which is similar to the receiver."
 
     ^ (self copyEmpty:size) grow:size
+!
+
+postCopyFrom:original
+    "sent to a freshly copied object to give it a chance to adjust things.
+     Notice, that for Sets/Dicts etc. a rehash is not needed, since the copy
+     will have the same hash key as the receiver (as long as ST/X provides the 
+     setHash: functionality)."
+
+    "for ST-80 compatibility, we try postCopy here ..."
+    ^ self postCopy
+
+    "Created: / 19.4.1998 / 19:59:42 / cg"
+    "Modified: / 19.4.1998 / 20:03:57 / cg"
 ! !
 
 !Collection methodsFor:'enumerating'!
@@ -1749,6 +1771,6 @@
 !Collection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.77 1998-04-07 07:52:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.78 1998-04-19 18:11:05 cg Exp $'
 ! !
 Collection initialize!