--- a/Set.st Sun Feb 10 14:42:30 2019 +0100
+++ b/Set.st Sun Feb 10 14:43:52 2019 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
@@ -1276,6 +1274,16 @@
!Set methodsFor:'queries'!
+capacity
+ "return the number of elements, that the receiver is prepared to take w.o. resizing.
+ Notice, that Sets do automatically resize as required,
+ so knowing the capacity is of no real use."
+
+ ^ keyArray size
+
+ "Modified (comment): / 17-03-2017 / 11:50:16 / stefan"
+!
+
collisionCount
"return the number of key collisions in the set.
There is a collision if two keys hash to the same value."
@@ -1324,6 +1332,27 @@
] loop.
!
+includes:anObject
+ "return true if the argument anObject is in the receiver"
+
+ tally == 0 ifTrue:[^ false]. "/ quick reject if empty
+ ^ (self find:(anObject ? NilEntry) ifAbsent:0) ~~ 0
+!
+
+isEmpty
+ "return true if the receiver is empty"
+
+ ^ tally == 0
+!
+
+isEmptyOrNil
+ "return true if the receiver is empty"
+
+ ^ tally == 0
+
+ "Created: / 23-02-2017 / 15:51:50 / stefan"
+!
+
maxChainLength
"return the number of the maximum chain length in the set.
This is the worst case overhead when accessing a key."
@@ -1342,6 +1371,33 @@
^ (key -> chainLength)
!
+notEmpty
+ "return true if the receiver is not empty"
+
+ ^ tally ~~ 0
+
+ "Created: 12.2.1997 / 12:39:02 / cg"
+!
+
+notEmptyOrNil
+ "return true if the receiver is not empty"
+
+ ^ tally ~~ 0
+
+ "Created: / 23-02-2017 / 15:51:58 / stefan"
+!
+
+occurrencesOf:anObject
+ "return the number of occurrences of anObject in the receiver.
+ As I am a Set, this can only return 0 or 1."
+
+ tally == 0 ifTrue:[^ 0].
+ (self find:(anObject ? NilEntry) ifAbsent:0) == 0 ifTrue:[^ 0].
+ ^ 1
+
+ "Modified: / 16.11.2001 / 10:30:14 / cg"
+!
+
size
"return the number of set elements"
@@ -1372,37 +1428,6 @@
!Set methodsFor:'testing'!
-capacity
- "return the number of elements, that the receiver is prepared to take w.o. resizing.
- Notice, that Sets do automatically resize as required,
- so knowing the capacity is of no real use."
-
- ^ keyArray size
-
- "Modified (comment): / 17-03-2017 / 11:50:16 / stefan"
-!
-
-includes:anObject
- "return true if the argument anObject is in the receiver"
-
- tally == 0 ifTrue:[^ false]. "/ quick reject if empty
- ^ (self find:(anObject ? NilEntry) ifAbsent:0) ~~ 0
-!
-
-isEmpty
- "return true if the receiver is empty"
-
- ^ tally == 0
-!
-
-isEmptyOrNil
- "return true if the receiver is empty"
-
- ^ tally == 0
-
- "Created: / 23-02-2017 / 15:51:50 / stefan"
-!
-
isFixedSize
"return true if the receiver cannot grow - this will vanish once
Arrays and Strings learn how to grow ..."
@@ -1416,33 +1441,6 @@
may change due to rehashing, when elements are added/removed"
^ false
-!
-
-notEmpty
- "return true if the receiver is not empty"
-
- ^ tally ~~ 0
-
- "Created: 12.2.1997 / 12:39:02 / cg"
-!
-
-notEmptyOrNil
- "return true if the receiver is not empty"
-
- ^ tally ~~ 0
-
- "Created: / 23-02-2017 / 15:51:58 / stefan"
-!
-
-occurrencesOf:anObject
- "return the number of occurrences of anObject in the receiver.
- As I am a Set, this can only return 0 or 1."
-
- tally == 0 ifTrue:[^ 0].
- (self find:(anObject ? NilEntry) ifAbsent:0) == 0 ifTrue:[^ 0].
- ^ 1
-
- "Modified: / 16.11.2001 / 10:30:14 / cg"
! !
!Set methodsFor:'visiting'!