*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Tue, 22 Aug 2000 21:52:14 +0200
changeset 5559 426dee57de44
parent 5558 dfdb1198bf6a
child 5560 89a83b354d27
*** empty log message ***
IdentitySet.st
SequenceableCollection.st
--- a/IdentitySet.st	Tue Aug 22 16:04:56 2000 +0200
+++ b/IdentitySet.st	Tue Aug 22 21:52:14 2000 +0200
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+"{ Package: 'stx:libbasic' }"
+
 Set subclass:#IdentitySet
 	instanceVariableNames:''
 	classVariableNames:''
@@ -158,6 +160,26 @@
 
 !IdentitySet methodsFor:'testing'!
 
+identicalContentsAs:aCollection
+    "return true if the receiver and aCollection represent collections
+     with identical contents (but not caring for order)."
+
+    aCollection size == self size ifFalse:[^ false].
+    aCollection do:[:eachElement |
+        (self includesIdentical:eachElement) ifFalse:[^ false]
+    ].
+    ^ true
+
+    "
+     |col|
+
+     col := #('aaa' 'bbb' 'ccc' 'ddd').
+     col identicalContentsAs:(col asIdentitySet).  
+     col identicalContentsAs:(col copy asIdentitySet).  
+     col identicalContentsAs:(col deepCopy asIdentitySet).  
+   "
+!
+
 includesIdentical:anObject
     "for identitySet, the #includes: test already tests for identity"
 
@@ -169,5 +191,5 @@
 !IdentitySet class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/IdentitySet.st,v 1.24 1999-08-24 10:49:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/IdentitySet.st,v 1.25 2000-08-22 19:52:01 cg Exp $'
 ! !
--- a/SequenceableCollection.st	Tue Aug 22 16:04:56 2000 +0200
+++ b/SequenceableCollection.st	Tue Aug 22 21:52:14 2000 +0200
@@ -961,7 +961,8 @@
      stop  "{ Class: SmallInteger }" |
 
     (aCollection == self) ifTrue:[^ true].
-    (aCollection isSequenceable) ifFalse:[^ false].
+    (aCollection size == self size) ifFalse:[^ false].
+    (aCollection isSequenceable) ifFalse:[^ aCollection identicalContentsAs:self].
 
     stop := self size.
     stop == (aCollection size) ifFalse:[^ false].
@@ -5021,6 +5022,6 @@
 !SequenceableCollection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.140 2000-08-16 12:05:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.141 2000-08-22 19:52:14 cg Exp $'
 ! !
 SequenceableCollection initialize!