Tools__ClassSorter.st
changeset 17643 15c9a7e95913
parent 17602 36908309a12c
equal deleted inserted replaced
17642:917a57c6efcb 17643:15c9a7e95913
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "
     1 "
     4  COPYRIGHT (c) 2006 by eXept Software AG
     2  COPYRIGHT (c) 2006 by eXept Software AG
     5 	      All Rights Reserved
     3 	      All Rights Reserved
     6 
     4 
     7  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
    48 ! !
    46 ! !
    49 
    47 
    50 !ClassSorter methodsFor:'filtering'!
    48 !ClassSorter methodsFor:'filtering'!
    51 
    49 
    52 sort: classes
    50 sort: classes
    53     "Sort nodes according to their position in the class hierarchy"
    51         "Sort nodes according to their position in the class hierarchy"
    54 
    52 
    55     | supersChain |
    53         | supersChain |
    56 
    54         self initializeResults.
    57     self initializeResults.
    55         classes do: 
    58     classes do:[:eachClass | 
    56                 [:class | 
    59         supersChain := eachClass withAllSuperclasses intersect:classes.
    57                 supersChain := class  withAllSuperclasses reversed.
    60         order add: supersChain reverse "contents" -> eachClass
    58                 supersChain removeAllSuchThat: [:cl | (classes includes: cl) not].
    61     ].
    59                 order add: supersChain "contents" -> class].
    62     self buildIndentIndex.
    60         self buildIndentIndex.
    63     ^ self collectSortedClasses
    61         ^self collectSortedClasses
    64 
    62 
    65     "Modified: / 21-01-2008 / 19:43:24 / janfrog"
    63     "Modified: / 21-01-2008 / 19:43:24 / janfrog"
    66     "Modified: / 27-07-2017 / 09:38:20 / stefan"
       
    67 ! !
    64 ! !
    68 
    65 
    69 !ClassSorter methodsFor:'private'!
    66 !ClassSorter methodsFor:'private'!
    70 
    67 
    71 buildIndentIndex
    68 buildIndentIndex