Bag.st
changeset 11935 799201e55e7e
parent 11523 d47e76cf572d
child 12823 aa0b7ba87240
--- a/Bag.st	Wed Sep 16 13:35:08 2009 +0200
+++ b/Bag.st	Wed Sep 16 13:47:20 2009 +0200
@@ -102,6 +102,10 @@
 !Bag methodsFor:'Compatibility-Dolphin'!
 
 asAssociations
+    "return the dictionary which associates occurrence-counts
+     to the bags elements. 
+     Same as #contents for dolphin compatibility."
+
     ^ contents
 ! !
 
@@ -249,20 +253,27 @@
 !Bag methodsFor:'comparing'!
 
 = aBag
+    "Compare the receiver with the argument and return true if the
+     receiver is equal to the argument (i.e. has the same size and elements).
+     Otherwise return false."
+
     aBag species == self species ifFalse:[^ false].
     self size == aBag size ifFalse:[^ false].
     self valuesAndCountsDo:[:val :cnt |
-	(aBag occurrencesOf:val) == cnt ifFalse:[^ false]
+        (aBag occurrencesOf:val) == cnt ifFalse:[^ false]
     ].
     ^ true
 !
 
 hash
+    "return an integer useful for hashing on the receiver;
+     redefined since = is redefined here."
+
     |h|
 
     h := self size.
     self valuesAndCountsDo:[:val :cnt |
-	h := h + cnt hash.
+        h := h + cnt hash.
     ].
     ^ h
 ! !
@@ -397,5 +408,5 @@
 !Bag class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.39 2009-02-08 10:11:34 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.40 2009-09-16 11:47:20 cg Exp $'
 ! !