equal
deleted
inserted
replaced
28 element given as second arg. |
28 element given as second arg. |
29 Thus a sortBlock of [:a :b | a < b] defines ascending sort-order, |
29 Thus a sortBlock of [:a :b | a < b] defines ascending sort-order, |
30 while [:a :b | a > b] defines descening order. |
30 while [:a :b | a > b] defines descening order. |
31 The default sortBlock for SortedCollections is the first one. |
31 The default sortBlock for SortedCollections is the first one. |
32 |
32 |
33 $Header: /cvs/stx/stx/libbasic/SortedCollection.st,v 1.5 1994-01-08 16:23:33 claus Exp $ |
33 $Header: /cvs/stx/stx/libbasic/SortedCollection.st,v 1.6 1994-01-16 03:46:34 claus Exp $ |
34 '! |
34 '! |
35 |
35 |
36 !SortedCollection class methodsFor:'initialization'! |
36 !SortedCollection class methodsFor:'initialization'! |
37 |
37 |
38 initialize |
38 initialize |
183 "return how many times the argument, anObject is in the collection. |
183 "return how many times the argument, anObject is in the collection. |
184 Redefined, since due to beeing sorted, the range of checked objects |
184 Redefined, since due to beeing sorted, the range of checked objects |
185 can be limited i.e. it can be done much faster." |
185 can be limited i.e. it can be done much faster." |
186 |
186 |
187 |index "{ Class: SmallInteger }" |
187 |index "{ Class: SmallInteger }" |
188 mySize "{ Class: SmallInteger }" |
|
189 tally "{ Class: SmallInteger }" | |
188 tally "{ Class: SmallInteger }" | |
190 |
189 |
191 index := self findIndexFor:anObject. |
190 index := self findIndexFor:anObject. |
192 ((index < firstIndex) or:[index > lastIndex]) ifTrue:[^ 0]. |
191 ((index < firstIndex) or:[index > lastIndex]) ifTrue:[^ 0]. |
193 |
192 |