author | Claus Gittinger <cg@exept.de> |
Sat, 02 May 2020 21:40:13 +0200 | |
changeset 5476 | 7355a4b11cb6 |
parent 5209 | 6ea076e6515d |
permissions | -rw-r--r-- |
5209 | 1 |
"{ Encoding: utf8 }" |
2 |
||
4281 | 3 |
" |
4 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
14 |
"{ Package: 'stx:libbasic2' }" |
|
15 |
||
16 |
"{ NameSpace: Smalltalk }" |
|
17 |
||
182 | 18 |
Object subclass:#SequenceableCollectionSorter |
19 |
instanceVariableNames:'collection atSelector putSelector sizeSelector sortBlock' |
|
20 |
classVariableNames:'DefaultSortBlock' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'Collections-Support' |
|
23 |
! |
|
24 |
||
25 |
!SequenceableCollectionSorter class methodsFor:'documentation'! |
|
26 |
||
4281 | 27 |
copyright |
28 |
" |
|
29 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
182 | 41 |
documentation |
42 |
" |
|
43 |
a SequenceableCollectionSorter allows for anything which responds to |
|
44 |
keyed at/atPut messages to be sorted just like a SequenceableCollection. |
|
183
01781ca31dad
really use #<= for comparing (used #<)
Claus Gittinger <cg@exept.de>
parents:
182
diff
changeset
|
45 |
Since the access messages can be customized, even non collections |
01781ca31dad
really use #<= for comparing (used #<)
Claus Gittinger <cg@exept.de>
parents:
182
diff
changeset
|
46 |
(or collection simulators, models etc.) can be sorted with these sorters. |
182 | 47 |
(use #atSelector: / #putSelector: and #sizeSelector: for customization). |
48 |
||
49 |
As with collection sorting, the sortBlock can be specified and defaults to |
|
50 |
a block which compares using #< messages. |
|
51 |
" |
|
52 |
! |
|
53 |
||
54 |
examples |
|
55 |
" |
|
56 |
|a sorter| |
|
57 |
||
58 |
a := #(10 5 2 17 5 99 -5). |
|
59 |
sorter := SequenceableCollectionSorter on:a. |
|
60 |
sorter sort. |
|
350 | 61 |
Transcript showCR:a printString |
182 | 62 |
" |
63 |
! ! |
|
64 |
||
65 |
!SequenceableCollectionSorter class methodsFor:'initialization'! |
|
66 |
||
67 |
initialize |
|
68 |
DefaultSortBlock := [:a :b | a <= b] |
|
69 |
||
70 |
" |
|
71 |
SequenceableCollectionSorter initialize |
|
72 |
" |
|
73 |
||
74 |
"Modified: 6.2.1996 / 15:47:48 / cg" |
|
75 |
! ! |
|
76 |
||
77 |
!SequenceableCollectionSorter class methodsFor:'instance creation'! |
|
78 |
||
79 |
on:aCollection |
|
80 |
^ self new collection:aCollection; sortBlock:DefaultSortBlock |
|
81 |
||
82 |
"Created: 6.2.1996 / 15:39:09 / cg" |
|
83 |
"Modified: 6.2.1996 / 16:07:36 / cg" |
|
84 |
! |
|
85 |
||
86 |
on:aCollection using:aTwoArgBlock |
|
87 |
^ self new collection:aCollection; sortBlock:aTwoArgBlock |
|
88 |
||
89 |
"Created: 6.2.1996 / 15:39:32 / cg" |
|
90 |
! |
|
91 |
||
92 |
sort:aCollection |
|
93 |
(self new collection:aCollection; sortBlock:DefaultSortBlock) sort |
|
94 |
||
95 |
"Created: 6.2.1996 / 15:40:04 / cg" |
|
96 |
"Modified: 6.2.1996 / 16:07:42 / cg" |
|
97 |
! |
|
98 |
||
99 |
sort:aCollection using:aTwoArgBlock |
|
100 |
(self new collection:aCollection; sortBlock:aTwoArgBlock) sort |
|
101 |
||
102 |
"Created: 6.2.1996 / 15:39:58 / cg" |
|
103 |
! ! |
|
104 |
||
105 |
!SequenceableCollectionSorter methodsFor:'accessing'! |
|
106 |
||
107 |
atSelector:aSymbol |
|
108 |
"set the selector to access elements. |
|
109 |
If nil (the default), elements are accessed via #at:" |
|
110 |
||
111 |
atSelector := aSymbol |
|
112 |
||
113 |
"Created: 6.2.1996 / 15:35:49 / cg" |
|
114 |
! |
|
115 |
||
116 |
collection |
|
117 |
"return the collections being sorted." |
|
118 |
||
119 |
^ collection |
|
120 |
||
121 |
"Created: 6.2.1996 / 15:37:02 / cg" |
|
122 |
! |
|
123 |
||
124 |
collection:aCollection |
|
125 |
"set the collections being sorted." |
|
126 |
||
127 |
collection := aCollection |
|
128 |
||
129 |
"Created: 6.2.1996 / 15:37:20 / cg" |
|
130 |
! |
|
131 |
||
132 |
putSelector:aSymbol |
|
133 |
"set the selector to access elements. |
|
134 |
If nil (the default), elements are accessed via #at:put:" |
|
135 |
||
136 |
putSelector := aSymbol |
|
137 |
||
138 |
"Created: 6.2.1996 / 15:36:14 / cg" |
|
139 |
! |
|
140 |
||
141 |
sizeSelector:aSymbol |
|
142 |
"set the selector to get the collections size. |
|
143 |
If nil (the default), elements are accessed via #size" |
|
144 |
||
145 |
sizeSelector := aSymbol |
|
146 |
||
147 |
"Created: 6.2.1996 / 15:36:33 / cg" |
|
148 |
! |
|
149 |
||
150 |
sortBlock |
|
151 |
"return the sortBlock which is used to compare two elements. |
|
152 |
The default sortBlock compares elements by sending the #< message." |
|
153 |
||
154 |
^ sortBlock |
|
155 |
||
156 |
"Created: 6.2.1996 / 15:38:32 / cg" |
|
157 |
! |
|
158 |
||
159 |
sortBlock:aTwoArgBlock |
|
160 |
"set the sortBlock which is used to compare two elements. |
|
161 |
The default sortBlock compares elements by sending the #< message." |
|
162 |
||
163 |
sortBlock := aTwoArgBlock |
|
164 |
||
165 |
"Created: 6.2.1996 / 15:38:20 / cg" |
|
166 |
! ! |
|
167 |
||
168 |
!SequenceableCollectionSorter methodsFor:'sorting'! |
|
169 |
||
170 |
defaultSort:inBegin to:inEnd |
|
171 |
"actual sort worker for sorting when the sortBlock is nil (or the default) |
|
184 | 172 |
and default atSelector/putSelectors are to be used. |
173 |
This will execute slightly faster, since no #perform-indirection is needed." |
|
182 | 174 |
|
175 |
|begin "{ Class: SmallInteger }" |
|
176 |
end "{ Class: SmallInteger }" |
|
177 |
b "{ Class: SmallInteger }" |
|
178 |
e "{ Class: SmallInteger }" |
|
179 |
middleElement temp1 temp2 | |
|
180 |
||
181 |
begin := inBegin. "/ this also does a type-check |
|
182 |
end := inEnd. |
|
183 |
||
184 |
b := begin. |
|
185 |
e := end. |
|
186 |
middleElement := collection at:((b + e) // 2). |
|
187 |
||
188 |
[b < e] whileTrue:[ |
|
183
01781ca31dad
really use #<= for comparing (used #<)
Claus Gittinger <cg@exept.de>
parents:
182
diff
changeset
|
189 |
[b < end and:[(collection at:b) <= middleElement]] whileTrue:[b := b + 1]. |
01781ca31dad
really use #<= for comparing (used #<)
Claus Gittinger <cg@exept.de>
parents:
182
diff
changeset
|
190 |
[e > begin and:[middleElement <= (collection at:e)]] whileTrue:[e := e - 1]. |
182 | 191 |
|
192 |
(b <= e) ifTrue:[ |
|
193 |
(b == e) ifFalse:[ |
|
194 |
temp1 := collection at:b. temp2 := collection at:e. |
|
195 |
collection at:b put:temp2. collection at:e put:temp1 |
|
196 |
]. |
|
197 |
b := b + 1. |
|
198 |
e := e - 1 |
|
199 |
] |
|
200 |
]. |
|
201 |
(begin < e) ifTrue:[self defaultSort:begin to:e]. |
|
202 |
(b < end) ifTrue:[self defaultSort:b to:end] |
|
203 |
||
204 |
"Created: 6.2.1996 / 15:44:37 / cg" |
|
184 | 205 |
"Modified: 6.2.1996 / 18:06:23 / cg" |
182 | 206 |
! |
207 |
||
585
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
208 |
nonDefaultSort3:inBegin to:inEnd with:p |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
209 |
"actual sort worker for sorting when a non default sortBlock |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
210 |
with 3 args (stringSort) is used." |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
211 |
|
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
212 |
|begin "{ Class: SmallInteger }" |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
213 |
end "{ Class: SmallInteger }" |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
214 |
b "{ Class: SmallInteger }" |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
215 |
e "{ Class: SmallInteger }" |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
216 |
middleElement temp1 temp2 |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
217 |
atSel putSel| |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
218 |
|
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
219 |
atSel := atSelector ? #at:. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
220 |
putSel := putSelector ? #at:put:. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
221 |
|
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
222 |
begin := inBegin. "/ this also does a type-check |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
223 |
end := inEnd. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
224 |
|
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
225 |
b := begin. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
226 |
e := end. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
227 |
middleElement := collection perform:atSel with:((b + e) // 2). |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
228 |
|
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
229 |
[b < e] whileTrue:[ |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
230 |
[b < end |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
231 |
and:[sortBlock |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
232 |
value:p |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
233 |
value:(collection perform:atSel with:b) |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
234 |
value:middleElement]] |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
235 |
whileTrue:[b := b + 1]. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
236 |
[e > begin |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
237 |
and:[sortBlock |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
238 |
value:p |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
239 |
value:middleElement |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
240 |
value:(collection perform:atSel with:e)]] |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
241 |
whileTrue:[e := e - 1]. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
242 |
|
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
243 |
(b <= e) ifTrue:[ |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
244 |
(b == e) ifFalse:[ |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
245 |
temp1 := (collection perform:atSel with:b). |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
246 |
temp2 := (collection perform:atSel with:e). |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
247 |
collection perform:putSel with:b with:temp2. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
248 |
collection perform:putSel with:e with:temp1. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
249 |
]. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
250 |
b := b + 1. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
251 |
e := e - 1 |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
252 |
] |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
253 |
]. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
254 |
(begin < e) ifTrue:[self nonDefaultSort3:begin to:e with:p]. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
255 |
(b < end) ifTrue:[self nonDefaultSort3:b to:end with:p] |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
256 |
|
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
257 |
"Modified: / 27.10.1997 / 04:52:41 / cg" |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
258 |
"Created: / 27.10.1997 / 18:54:54 / cg" |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
259 |
! |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
260 |
|
182 | 261 |
nonDefaultSort:inBegin to:inEnd |
262 |
"actual sort worker for sorting when a non default sortBlock |
|
184 | 263 |
or nonNil access selectors are used." |
182 | 264 |
|
265 |
|begin "{ Class: SmallInteger }" |
|
266 |
end "{ Class: SmallInteger }" |
|
267 |
b "{ Class: SmallInteger }" |
|
268 |
e "{ Class: SmallInteger }" |
|
585
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
269 |
middleElement temp1 temp2 |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
270 |
atSel putSel| |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
271 |
|
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
272 |
atSel := atSelector ? #at:. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
273 |
putSel := putSelector ? #at:put:. |
182 | 274 |
|
275 |
begin := inBegin. "/ this also does a type-check |
|
276 |
end := inEnd. |
|
277 |
||
278 |
b := begin. |
|
279 |
e := end. |
|
585
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
280 |
middleElement := collection perform:atSel with:((b + e) // 2). |
182 | 281 |
|
282 |
[b < e] whileTrue:[ |
|
283 |
[b < end |
|
284 |
and:[sortBlock |
|
585
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
285 |
value:(collection perform:atSel with:b) |
182 | 286 |
value:middleElement]] |
287 |
whileTrue:[b := b + 1]. |
|
288 |
[e > begin |
|
289 |
and:[sortBlock |
|
290 |
value:middleElement |
|
585
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
291 |
value:(collection perform:atSel with:e)]] |
182 | 292 |
whileTrue:[e := e - 1]. |
293 |
||
294 |
(b <= e) ifTrue:[ |
|
295 |
(b == e) ifFalse:[ |
|
585
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
296 |
temp1 := (collection perform:atSel with:b). |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
297 |
temp2 := (collection perform:atSel with:e). |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
298 |
collection perform:putSel with:b with:temp2. |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
299 |
collection perform:putSel with:e with:temp1. |
182 | 300 |
]. |
301 |
b := b + 1. |
|
302 |
e := e - 1 |
|
303 |
] |
|
304 |
]. |
|
305 |
(begin < e) ifTrue:[self nonDefaultSort:begin to:e]. |
|
306 |
(b < end) ifTrue:[self nonDefaultSort:b to:end] |
|
307 |
||
585
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
308 |
"Created: / 6.2.1996 / 16:06:46 / cg" |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
309 |
"Modified: / 27.10.1997 / 04:52:41 / cg" |
182 | 310 |
! |
311 |
||
312 |
sort |
|
313 |
|sz| |
|
314 |
||
315 |
sizeSelector isNil ifTrue:[ |
|
316 |
sz := collection size |
|
317 |
] ifFalse:[ |
|
318 |
sz := collection perform:sizeSelector |
|
319 |
]. |
|
320 |
self sort:1 to:sz |
|
321 |
||
322 |
"Created: 6.2.1996 / 15:41:21 / cg" |
|
323 |
! |
|
324 |
||
325 |
sort:from to:to |
|
326 |
"actual sort worker for sort-messages" |
|
327 |
||
328 |
(atSelector isNil |
|
329 |
and:[putSelector isNil |
|
330 |
and:[sortBlock isNil or:[sortBlock == DefaultSortBlock]]]) ifTrue:[ |
|
331 |
self defaultSort:from to:to |
|
332 |
] ifFalse:[ |
|
5209 | 333 |
sortBlock argumentCount == 3 ifTrue:[ |
585
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
334 |
self nonDefaultSort3:from to:to with:nil "p" |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
335 |
] ifFalse:[ |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
336 |
self nonDefaultSort:from to:to |
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
337 |
] |
182 | 338 |
]. |
339 |
||
585
ab03e26e2df1
support 3-arg sorting using a collationPolicy
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
340 |
"Modified: / 27.10.1997 / 18:55:48 / cg" |
182 | 341 |
! ! |
342 |
||
343 |
!SequenceableCollectionSorter class methodsFor:'documentation'! |
|
344 |
||
345 |
version |
|
4281 | 346 |
^ '$Header$' |
182 | 347 |
! ! |
4281 | 348 |
|
349 |
||
182 | 350 |
SequenceableCollectionSorter initialize! |