FileSorter.st
changeset 1369 65ba75319c22
parent 1368 cada7bfb7769
child 1522 7a569eca4d68
equal deleted inserted replaced
1368:cada7bfb7769 1369:65ba75319c22
    83 
    83 
    84 !FileSorter methodsFor:'action'!
    84 !FileSorter methodsFor:'action'!
    85 
    85 
    86 sortItemList:aList
    86 sortItemList:aList
    87 
    87 
    88     |selectorSymbol instanceSortBlock cmpOp sortBlock|
    88     |selectorSymbol instanceSortBlock cmpOp sortBlock locSortReverse|
    89 
    89 
    90     selectorSymbol := selector asSymbol.
    90     selectorSymbol := selector asSymbol.
    91     sortReverse ifTrue:[
    91     sortReverse ifTrue:[
    92         cmpOp := #'>'
    92         cmpOp := #'>'
    93     ] ifFalse:[
    93     ] ifFalse:[
    94         cmpOp := #'<'
    94         cmpOp := #'<'
    95     ].
    95     ].
       
    96     locSortReverse := self sortReverse.
    96     instanceSortBlock := [:a :b | 
    97     instanceSortBlock := [:a :b | 
    97         |entry1 entry2|
    98         |entry1 entry2|
    98 
    99 
    99         entry1 := (a perform:selectorSymbol).
   100         entry1 := (a perform:selectorSymbol).
   100         entry2 := (b perform:selectorSymbol).
   101         entry2 := (b perform:selectorSymbol).
   101         ((entry1 isNil) or:[entry2 isNil]) ifTrue:[
   102         ((entry1 isNil) or:[entry2 isNil]) ifTrue:[
   102             ((entry1 isNil) and:[entry2 isNil]) ifTrue:[
   103             ((entry1 isNil) and:[entry2 isNil]) ifTrue:[
   103                 true
   104                 true
   104             ] ifFalse:[
   105             ] ifFalse:[
   105                 ((entry1 notNil) and:[entry2 isNil]) ifTrue:[
   106                 ((entry1 notNil) and:[entry2 isNil]) ifTrue:[
   106                     sortReverse
   107                     locSortReverse
   107                 ] ifFalse:[
   108                 ] ifFalse:[
   108                     sortReverse not
   109                     locSortReverse not
   109                 ]
   110                 ]
   110             ]
   111             ]
   111         ] ifFalse:[
   112         ] ifFalse:[
   112             ((selector = #baseName) and:[sortCaseless]) ifTrue:[
   113             ((selector = #baseName) and:[sortCaseless]) ifTrue:[
   113                 entry1 := entry1 asLowercase.
   114                 entry1 := entry1 asLowercase.
   138 ! !
   139 ! !
   139 
   140 
   140 !FileSorter class methodsFor:'documentation'!
   141 !FileSorter class methodsFor:'documentation'!
   141 
   142 
   142 version
   143 version
   143     ^ '$Header: /cvs/stx/stx/libbasic2/FileSorter.st,v 1.2 2003-12-01 11:13:12 penk Exp $'
   144     ^ '$Header: /cvs/stx/stx/libbasic2/FileSorter.st,v 1.3 2003-12-01 13:04:08 penk Exp $'
   144 ! !
   145 ! !