ClassOrganizer.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 29 Jan 2013 14:40:26 +0000
branchjv
changeset 3121 19723298dd2c
parent 3042 48e76977cdc3
child 3128 87750af738dc
permissions -rw-r--r--
Bugfix: reading of Java class extensions methods.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20
dbeb4f20377e Initial revision
claus
parents:
diff changeset
     1
"
dbeb4f20377e Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
     3
	      All Rights Reserved
20
dbeb4f20377e Initial revision
claus
parents:
diff changeset
     4
dbeb4f20377e Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
dbeb4f20377e Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
dbeb4f20377e Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
dbeb4f20377e Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
dbeb4f20377e Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    11
"
975
15cb75b2e051 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
    12
"{ Package: 'stx:libbasic3' }"
15cb75b2e051 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
    13
27
claus
parents: 20
diff changeset
    14
Object subclass:#ClassOrganizer
593
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    15
	instanceVariableNames:'globalComment categoryArray categoryStops elementArray class
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    16
		categories'
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    17
	classVariableNames:''
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    18
	poolDictionaries:''
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    19
	category:'Kernel-Support'
20
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    20
!
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    21
27
claus
parents: 20
diff changeset
    22
!ClassOrganizer class methodsFor:'documentation'!
20
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    23
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    24
copyright
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    25
"
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    26
 COPYRIGHT (c) 1995 by Claus Gittinger
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    27
	      All Rights Reserved
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    28
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    29
 This software is furnished under a license and may be used
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    34
 hereby transferred.
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    35
"
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    36
!
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    37
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    38
documentation
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    39
"
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    40
    in contrast to other smalltalks, ST/X does not keep the
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    41
    method <-> category associations in the class (as organization),
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    42
    but instead keeps the category as an instance variable of methods.
20
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    43
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    44
    For compatibility with (fileOut-) files which include a class organization
27
claus
parents: 20
diff changeset
    45
    message, 'aClass organization' returns an instance of this class, which
20
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    46
    implements the category change functionality.
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    47
    Also, some PD code seems to use & define methods for ClassOrganizers 
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    48
    - having this (somewhat dummy) class around helps to fileIn that code.
27
claus
parents: 20
diff changeset
    49
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    50
    Notice, that instances of ClassOrganizer are NOT used in the current ST/X
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    51
    system; all of this is pure compatibility mimicri.
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    52
593
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    53
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    54
    This is an additional goody class; therefore:
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    55
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    56
    THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTOR ``AS IS'' AND
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    57
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    58
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    59
    ARE DISCLAIMED.  IN NO EVENT SHALL THE CONTRIBUTOR BE LIABLE
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    60
    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    61
    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    62
    OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    63
    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    64
    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    65
    OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    66
    SUCH DAMAGE.
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
    67
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    68
    [author:]
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    69
        Claus Gittinger
20
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    70
"
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    71
! !
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    72
27
claus
parents: 20
diff changeset
    73
!ClassOrganizer class methodsFor:'instance creation'!
20
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    74
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    75
for:aClass
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    76
    "create & return a new instance of myself, to organize aClass"
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    77
1086
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
    78
    ^ super new class:aClass
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
    79
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
    80
    "Modified: / 31.10.2001 / 08:58:49 / cg"
20
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    81
! !
dbeb4f20377e Initial revision
claus
parents:
diff changeset
    82
914
8b9e00e7a4ba compatibility
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
    83
!ClassOrganizer class methodsFor:'defaults'!
8b9e00e7a4ba compatibility
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
    84
8b9e00e7a4ba compatibility
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
    85
defaultProtocol 
8b9e00e7a4ba compatibility
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
    86
    ^ 'as yet unspecified'
8b9e00e7a4ba compatibility
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
    87
! !
8b9e00e7a4ba compatibility
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
    88
3012
4f40b8304d54 Added InvalidChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3011
diff changeset
    89
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    90
!ClassOrganizer methodsFor:'accessing'!
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    91
658
e5971ee29758 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 631
diff changeset
    92
addCategory:aCategory
e5971ee29758 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 631
diff changeset
    93
    "ignored."
e5971ee29758 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 631
diff changeset
    94
e5971ee29758 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 631
diff changeset
    95
e5971ee29758 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 631
diff changeset
    96
    "
e5971ee29758 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 631
diff changeset
    97
     Number organization addCategory:'foo'. 
e5971ee29758 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 631
diff changeset
    98
    "
e5971ee29758 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 631
diff changeset
    99
e5971ee29758 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 631
diff changeset
   100
    "Created: / 17.4.1998 / 14:42:16 / cg"
e5971ee29758 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 631
diff changeset
   101
!
e5971ee29758 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 631
diff changeset
   102
975
15cb75b2e051 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   103
addCategory:aCategory before:symbolOrNil
15cb75b2e051 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   104
    "ignored."
15cb75b2e051 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   105
!
15cb75b2e051 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   106
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   107
categories
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   108
    "return a collection of my classes method-categorySymbols"
27
claus
parents: 20
diff changeset
   109
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   110
    |set|
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   111
687
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   112
    categoryArray isNil ifTrue:[
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   113
        set := IdentitySet new.
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   114
        class methodDictionary keysAndValuesDo:[:sel :m |
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   115
            set add:m category
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   116
        ].
975
15cb75b2e051 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   117
        categoryArray := set asArray sort
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   118
    ].
687
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   119
    ^ categoryArray
27
claus
parents: 20
diff changeset
   120
claus
parents: 20
diff changeset
   121
    "
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   122
     SmallInteger organization categories 
27
claus
parents: 20
diff changeset
   123
    "
592
19591d2ed857 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
   124
687
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   125
    "Modified: / 20.6.1998 / 12:26:49 / cg"
27
claus
parents: 20
diff changeset
   126
!
claus
parents: 20
diff changeset
   127
claus
parents: 20
diff changeset
   128
categoryOfElement:aSelectorSymbol
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   129
    "return the category for the method specified by aSelectorSymbol.
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   130
     Return nil, if there is no such method."
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   131
27
claus
parents: 20
diff changeset
   132
    |m|
claus
parents: 20
diff changeset
   133
claus
parents: 20
diff changeset
   134
    m := class compiledMethodAt:aSelectorSymbol.
claus
parents: 20
diff changeset
   135
    m isNil ifTrue:[^ nil].
claus
parents: 20
diff changeset
   136
    ^ m category
claus
parents: 20
diff changeset
   137
claus
parents: 20
diff changeset
   138
    "
claus
parents: 20
diff changeset
   139
     Number organization categoryOfElement:#foo. 
claus
parents: 20
diff changeset
   140
     Object organization categoryOfElement:#==   
claus
parents: 20
diff changeset
   141
    "
claus
parents: 20
diff changeset
   142
!
claus
parents: 20
diff changeset
   143
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   144
classComment
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   145
    "return the classes comment"
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   146
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   147
    ^ class comment
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   148
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   149
    "
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   150
     Number organization classComment  
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   151
    "
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   152
!
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   153
631
7f4f308742df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   154
elements
7f4f308742df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   155
    "return a collection of my classes selectors"
7f4f308742df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   156
7f4f308742df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   157
    |set|
7f4f308742df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   158
687
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   159
    elementArray isNil ifTrue:[
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   160
        set := IdentitySet new.
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   161
        class methodDictionary keysAndValuesDo:[:sel :m |
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   162
            set add:sel
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   163
        ].
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   164
        elementArray := set asArray
631
7f4f308742df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   165
    ].
687
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   166
    ^ elementArray
631
7f4f308742df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   167
7f4f308742df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   168
    "
7f4f308742df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   169
     SmallInteger organization elements 
7f4f308742df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   170
    "
7f4f308742df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   171
687
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   172
    "Modified: / 20.6.1998 / 12:27:23 / cg"
631
7f4f308742df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   173
!
7f4f308742df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   174
27
claus
parents: 20
diff changeset
   175
listAtCategoryNamed:aCategorySymbol
claus
parents: 20
diff changeset
   176
    "return a collection of selectors whose methods are categorized
claus
parents: 20
diff changeset
   177
     as aCategorySymbol"
claus
parents: 20
diff changeset
   178
claus
parents: 20
diff changeset
   179
    |list|
claus
parents: 20
diff changeset
   180
claus
parents: 20
diff changeset
   181
    list := OrderedCollection new.
556
05070d255d6a methodDictionary fixes
ca
parents: 258
diff changeset
   182
    class methodDictionary keysAndValuesDo:[:sel :mthd |
05070d255d6a methodDictionary fixes
ca
parents: 258
diff changeset
   183
        mthd category == aCategorySymbol ifTrue:[list add:sel]
27
claus
parents: 20
diff changeset
   184
    ].
903
2319988d0b9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
   185
    ^ list asOrderedCollection
27
claus
parents: 20
diff changeset
   186
claus
parents: 20
diff changeset
   187
    "
claus
parents: 20
diff changeset
   188
     SmallInteger organization listAtCategoryNamed:#arithmetic 
claus
parents: 20
diff changeset
   189
    "
900
318651783940 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 687
diff changeset
   190
!
318651783940 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 687
diff changeset
   191
318651783940 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 687
diff changeset
   192
removeCategory:aCategory
318651783940 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 687
diff changeset
   193
    "remove a categories assignments - dummy here "
318651783940 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 687
diff changeset
   194
318651783940 more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 687
diff changeset
   195
    "Modified: / 3.2.2000 / 23:49:27 / cg"
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   196
! !
27
claus
parents: 20
diff changeset
   197
687
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   198
!ClassOrganizer methodsFor:'change & update'!
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   199
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   200
update:something with:parameter from:changedObject
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   201
    changedObject == class ifTrue:[
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   202
        something == #methodTrap ifFalse:[
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   203
            categoryArray := elementArray := categories := nil
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   204
        ]
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   205
    ].
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   206
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   207
    "Created: / 20.6.1998 / 12:28:37 / cg"
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   208
    "Modified: / 20.6.1998 / 12:30:14 / cg"
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   209
! !
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   210
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   211
!ClassOrganizer methodsFor:'changing'!
27
claus
parents: 20
diff changeset
   212
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   213
changeFromString:organizationString
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   214
    "take category<->selector associations from aString, and change
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   215
     the categories of those methods. 
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   216
     Only required when filing in ST-80 code, which changes the categorization
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   217
     this way."
27
claus
parents: 20
diff changeset
   218
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   219
    |a category m|
27
claus
parents: 20
diff changeset
   220
claus
parents: 20
diff changeset
   221
    "
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   222
     (mis(use) parser for the scanning
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   223
    "
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   224
    a := Compiler evaluate:'#(' , organizationString , ')'.
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   225
    (a isMemberOf:Array) ifFalse:[^ self error:'malformed argument'].
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   226
    a do:[:row |
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   227
        category := row at:1.
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   228
        2 to:row size do:[:idx |
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   229
            |selector|
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   230
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   231
            selector := row at:idx.
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   232
            m := class compiledMethodAt:selector.
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   233
            m isNil ifTrue:[
258
bf9fd9ad4687 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   234
                Transcript showCR:'no method for ' , selector , ' in ', class name
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   235
            ] ifFalse:[
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   236
                m category:category.
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   237
            ]
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   238
        ]
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   239
    ].
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   240
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   241
    "
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   242
     TestClass 
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   243
        organization
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   244
            changeFromString:'( ''category1'' #foo1 #foo2 foo3)
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   245
                              ( ''category2'' #bar1 #bar2)'
27
claus
parents: 20
diff changeset
   246
    "
593
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   247
!
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   248
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   249
classify:aSelector under:aCategory
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   250
    "change the category of the method stored under aSelector
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   251
     to aCategory."
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   252
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   253
    |m list|
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   254
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   255
    class isNil ifTrue:[
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   256
        "/ sigh used without a class ...
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   257
        categories isNil ifTrue:[
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   258
            categories := Dictionary new.
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   259
        ].
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   260
        list := categories at:aCategory ifAbsent:nil.
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   261
        list isNil ifTrue:[
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   262
            list := OrderedCollection new.
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   263
            categories at:aCategory put:list.
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   264
        ].
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   265
        list add:aSelector.
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   266
        ^ self.
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   267
    ].
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   268
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   269
    m := class compiledMethodAt:aSelector.
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   270
    m notNil ifTrue:[
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   271
        m category:aCategory
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   272
    ].
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   273
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   274
    "Created: 20.6.1997 / 18:01:18 / cg"
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   275
    "Modified: 20.6.1997 / 18:09:37 / cg"
27
claus
parents: 20
diff changeset
   276
! !
claus
parents: 20
diff changeset
   277
claus
parents: 20
diff changeset
   278
!ClassOrganizer methodsFor:'printing & storing'!
claus
parents: 20
diff changeset
   279
claus
parents: 20
diff changeset
   280
printOn:aStream
claus
parents: 20
diff changeset
   281
    |coll|
claus
parents: 20
diff changeset
   282
593
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   283
    class notNil ifTrue:[
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   284
        coll := IdentityDictionary new.
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   285
        class methodDictionary keysAndValuesDo:[:sel :mthd |
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   286
            |cat list|
27
claus
parents: 20
diff changeset
   287
593
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   288
            cat := mthd category.
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   289
            list := coll at:cat ifAbsent:[].
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   290
            list isNil ifTrue:[
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   291
                coll at:cat put:(list := OrderedCollection new).
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   292
            ].
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   293
            list add:sel
556
05070d255d6a methodDictionary fixes
ca
parents: 258
diff changeset
   294
        ].
593
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   295
    ] ifFalse:[
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   296
        coll := categories
27
claus
parents: 20
diff changeset
   297
    ].
1086
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   298
    coll notNil ifTrue:[
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   299
        coll keysAndValuesDo:[:category :list |
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   300
            aStream nextPut:$(.
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   301
            aStream nextPutAll:category asString storeString.
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   302
            list do:[:selector |
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   303
                aStream space.
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   304
                selector storeOn:aStream
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   305
            ].
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   306
            aStream nextPut:$).
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   307
            aStream cr
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   308
        ]
27
claus
parents: 20
diff changeset
   309
    ]
claus
parents: 20
diff changeset
   310
claus
parents: 20
diff changeset
   311
    "
claus
parents: 20
diff changeset
   312
     Number organization printString
claus
parents: 20
diff changeset
   313
    "
593
e154dad9f21a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
   314
1086
e7def3397e7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   315
    "Modified: / 30.10.2001 / 17:58:50 / cg"
27
claus
parents: 20
diff changeset
   316
! !
claus
parents: 20
diff changeset
   317
claus
parents: 20
diff changeset
   318
!ClassOrganizer methodsFor:'private access'!
20
dbeb4f20377e Initial revision
claus
parents:
diff changeset
   319
dbeb4f20377e Initial revision
claus
parents:
diff changeset
   320
class:aClass
dbeb4f20377e Initial revision
claus
parents:
diff changeset
   321
    "set the class"
dbeb4f20377e Initial revision
claus
parents:
diff changeset
   322
687
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   323
    class := aClass.
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   324
    aClass addDependent:self.
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   325
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   326
    "
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   327
     ClassOrganizer organization
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   328
    "
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   329
47729447d24a remember categories & watch for class changes.
Claus Gittinger <cg@exept.de>
parents: 658
diff changeset
   330
    "Modified: / 20.6.1998 / 12:29:16 / cg"
20
dbeb4f20377e Initial revision
claus
parents:
diff changeset
   331
! !
dbeb4f20377e Initial revision
claus
parents:
diff changeset
   332
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   333
!ClassOrganizer class methodsFor:'documentation'!
20
dbeb4f20377e Initial revision
claus
parents:
diff changeset
   334
249
ea8e2098fa29 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   335
version
3121
19723298dd2c Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3042
diff changeset
   336
    ^ '$Header: ClassOrganizer.st 1909 2012-03-31 00:14:49Z vranyj1 $'
19723298dd2c Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3042
diff changeset
   337
!
19723298dd2c Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3042
diff changeset
   338
19723298dd2c Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3042
diff changeset
   339
version_HG
19723298dd2c Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3042
diff changeset
   340
19723298dd2c Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3042
diff changeset
   341
    ^ '$Changeset: <not expanded> $'
3012
4f40b8304d54 Added InvalidChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3011
diff changeset
   342
!
4f40b8304d54 Added InvalidChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3011
diff changeset
   343
4f40b8304d54 Added InvalidChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3011
diff changeset
   344
version_SVN
3121
19723298dd2c Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3042
diff changeset
   345
    ^ '§Id: ClassOrganizer.st 1909 2012-03-31 00:14:49Z vranyj1 §'
3012
4f40b8304d54 Added InvalidChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3011
diff changeset
   346
! !
3121
19723298dd2c Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3042
diff changeset
   347