author | Jan Vrany <jan.vrany@labware.com> |
Sat, 30 Sep 2023 22:55:25 +0100 | |
branch | jv |
changeset 19648 | 5df52d354504 |
parent 18532 | cccb41254edf |
permissions | -rw-r--r-- |
18532
cccb41254edf
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
12431
diff
changeset
|
1 |
"{ Encoding: utf8 }" |
cccb41254edf
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
12431
diff
changeset
|
2 |
|
9995 | 3 |
" |
4 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
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:libtool' }" |
|
15 |
||
16 |
"{ NameSpace: Tools }" |
|
17 |
||
18 |
Object subclass:#ClassSorter |
|
19 |
instanceVariableNames:'indents order' |
|
20 |
classVariableNames:'' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'Interface-Browsers-New' |
|
23 |
! |
|
24 |
||
25 |
!ClassSorter class methodsFor:'documentation'! |
|
26 |
||
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
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 |
||
41 |
!ClassSorter class methodsFor:'sorting'! |
|
42 |
||
43 |
sort: classes |
|
44 |
||
45 |
^self new sort: classes |
|
46 |
||
47 |
"Created: / 21-01-2008 / 19:40:19 / janfrog" |
|
48 |
! ! |
|
49 |
||
50 |
!ClassSorter methodsFor:'filtering'! |
|
51 |
||
52 |
sort: classes |
|
53 |
"Sort nodes according to their position in the class hierarchy" |
|
54 |
||
55 |
| supersChain | |
|
56 |
self initializeResults. |
|
57 |
classes do: |
|
58 |
[:class | |
|
59 |
supersChain := class withAllSuperclasses reversed. |
|
60 |
supersChain removeAllSuchThat: [:cl | (classes includes: cl) not]. |
|
61 |
order add: supersChain "contents" -> class]. |
|
62 |
self buildIndentIndex. |
|
63 |
^self collectSortedClasses |
|
64 |
||
65 |
"Modified: / 21-01-2008 / 19:43:24 / janfrog" |
|
66 |
! ! |
|
67 |
||
68 |
!ClassSorter methodsFor:'private'! |
|
69 |
||
70 |
buildIndentIndex |
|
71 |
indents := IdentityDictionary new. |
|
72 |
order do: [:assoc | indents at: assoc value put: assoc key size - 1]. |
|
73 |
! |
|
74 |
||
75 |
collectSortedClasses |
|
76 |
^order asArray collect: [:assoc | assoc value] |
|
77 |
||
78 |
"Created: / 21-01-2008 / 19:41:54 / janfrog" |
|
79 |
! |
|
80 |
||
81 |
initializeResults |
|
82 |
| i chain2 chain1 result max | |
|
83 |
order := SortedCollection sortBlock: |
|
84 |
[:assoc1 :assoc2 | |
|
85 |
result := nil. |
|
86 |
chain1 := assoc1 key. |
|
87 |
chain2 := assoc2 key. |
|
88 |
max := chain1 size min: chain2 size. |
|
89 |
i := 1. |
|
90 |
[result isNil and: [i <= max]] whileTrue: |
|
91 |
[(chain1 at: i) = (chain2 at: i) |
|
92 |
ifTrue: [i := i + 1] |
|
93 |
ifFalse: [result := (chain1 at: i) name < (chain2 at: i) name]]. |
|
94 |
result isNil ifTrue: [chain1 size < chain2 size] ifFalse: [result]] |
|
95 |
! ! |
|
96 |
||
97 |
!ClassSorter class methodsFor:'documentation'! |
|
98 |
||
99 |
version_CVS |
|
18532
cccb41254edf
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
12431
diff
changeset
|
100 |
^ '§Header: /cvs/stx/stx/libtool/Tools__ClassSorter.st,v 1.1 2011/07/01 13:28:45 cg Exp §' |
9995 | 101 |
! |
102 |
||
12431
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
103 |
version_HG |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
104 |
|
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
105 |
^ '$Changeset: <not expanded> $' |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
106 |
! |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
107 |
|
9995 | 108 |
version_SVN |
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12123
diff
changeset
|
109 |
^ '$Id: Tools__ClassSorter.st 7854 2012-01-30 17:49:41Z vranyj1 $' |
12431
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
110 |
! ! |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
111 |