--- a/Set.st Mon Aug 13 15:29:14 2012 +0200
+++ b/Set.st Mon Aug 13 17:29:03 2012 +0200
@@ -13,7 +13,7 @@
Collection subclass:#Set
instanceVariableNames:'tally keyArray'
- classVariableNames:'DeletedEntry'
+ classVariableNames:'DeletedEntry NilEntry'
poolDictionaries:''
category:'Collections-Unordered'
!
@@ -25,6 +25,13 @@
privateIn:Set
!
+Object subclass:#NilKey
+ instanceVariableNames:''
+ classVariableNames:'TheOneAndOnlyInstance'
+ poolDictionaries:''
+ privateIn:Set
+!
+
!Set class methodsFor:'documentation'!
copyright
@@ -101,10 +108,13 @@
"initialize the Set class"
DeletedEntry isNil ifTrue:[
- DeletedEntry := EmptySlot new
+ DeletedEntry := EmptySlot new.
+ NilEntry := NilKey new.
].
- "Set initialize"
+ "
+ Set initialize
+ "
"Modified: 24.1.1997 / 21:09:00 / cg"
! !
@@ -1083,6 +1093,7 @@
^ tally
! !
+
!Set methodsFor:'testing'!
capacity
@@ -1181,14 +1192,25 @@
! !
+!Set::NilKey class methodsFor:'instance creation'!
+
+basicNew
+ TheOneAndOnlyInstance isNil ifTrue:[
+ TheOneAndOnlyInstance := super basicNew
+ ].
+ ^ TheOneAndOnlyInstance
+
+
+! !
+
!Set class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.112 2012-08-04 18:34:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.113 2012-08-13 15:29:03 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.112 2012-08-04 18:34:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.113 2012-08-13 15:29:03 stefan Exp $'
! !
Set initialize!