Clean up code and document differences between #add: and #addLast:
authorStefan Vogel <sv@exept.de>
Wed, 21 Nov 2007 18:24:07 +0100
changeset 1917 61c602336f3d
parent 1916 9815828d0bf8
child 1918 38fa135c92ef
Clean up code and document differences between #add: and #addLast:
OrderedDictionary.st
--- a/OrderedDictionary.st	Wed Nov 21 18:24:03 2007 +0100
+++ b/OrderedDictionary.st	Wed Nov 21 18:24:07 2007 +0100
@@ -21,7 +21,6 @@
 	To: goodies-lib@cs.man.ac.uk
 	Subject: help 
 "
-
 "{ Package: 'stx:libbasic2' }"
 
 Dictionary subclass:#OrderedDictionary
@@ -279,7 +278,9 @@
 !OrderedDictionary methodsFor:'adding'!
 
 add: anAssociation 
-      "add anAssociation to the dictionary"
+      "add anAssociation to the dictionary. 
+       If anAssociation is already present in the dictionary,
+       the order will not be changed. (See also: #addLast:)"
 
       | key |
 
@@ -379,10 +380,12 @@
 !
 
 addLast: anAssociation 
-    "Add anAssociation to the end of the receiver."
+    "Add anAssociation to the end of the receiver.
+     If anAssociation is already present in the dictionary,
+     it will be moved to the end. (See also: #add:)"
 
     self removeFromOrder: anAssociation key.
-    order addLast: anAssociation key.
+    order add: anAssociation key.
     ^ super add: anAssociation.
 ! !
 
@@ -887,6 +890,6 @@
 !OrderedDictionary class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Attic/OrderedDictionary.st,v 1.22 2006-01-25 12:22:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Attic/OrderedDictionary.st,v 1.23 2007-11-21 17:24:07 stefan Exp $'
 
 ! !