ClassDescription.st
changeset 10 4f1f9a91e406
parent 3 24d81bf47225
child 68 59faa75185ba
equal deleted inserted replaced
9:b07612967dfa 10:4f1f9a91e406
    30 
    30 
    31 name            <String>        the classes name
    31 name            <String>        the classes name
    32 category        <String>        the classes category
    32 category        <String>        the classes category
    33 instvars        <String>        the names of the instance variables
    33 instvars        <String>        the names of the instance variables
    34 
    34 
    35 $Header: /cvs/stx/stx/libbasic/ClassDescription.st,v 1.3 1993-10-13 00:15:19 claus Exp $
    35 $Header: /cvs/stx/stx/libbasic/ClassDescription.st,v 1.4 1993-11-08 02:29:45 claus Exp $
    36 '!
    36 '!
    37 
    37 
    38 !ClassDescription methodsFor:'accessing'!
    38 !ClassDescription methodsFor:'accessing'!
    39 
    39 
    40 instanceVariableString
    40 instanceVariableString
    51      (see Behavior)."
    51      (see Behavior)."
    52 
    52 
    53     instvars := aString.
    53     instvars := aString.
    54     self changed
    54     self changed
    55 !
    55 !
       
    56 
       
    57 instVarNames
       
    58     "return a collection of the instance variable name-strings"
       
    59 
       
    60     instvars isNil ifTrue:[
       
    61         ^ OrderedCollection new
       
    62     ].
       
    63     ^ instvars asCollectionOfWords
       
    64 !
       
    65 
       
    66 allInstVarNames
       
    67     "return a collection of all the instance variable name-strings
       
    68      this includes all superclass-instance variables"
       
    69 
       
    70     ^ self addAllInstVarNamesTo:(OrderedCollection new)
       
    71 !
       
    72 
    56 
    73 
    57 setName:aString
    74 setName:aString
    58     "set the classes name - be careful, it will be still
    75     "set the classes name - be careful, it will be still
    59      in the Smalltalk dictionary - under another key"
    76      in the Smalltalk dictionary - under another key"
    60 
    77 
    76 category:aStringOrSymbol
    93 category:aStringOrSymbol
    77     "set the category of the class to be the argument, aString"
    94     "set the category of the class to be the argument, aString"
    78 
    95 
    79     category := aStringOrSymbol asSymbol
    96     category := aStringOrSymbol asSymbol
    80 ! !
    97 ! !
       
    98 
       
    99 !ClassDescription methodsFor:'renaming'!
       
   100 
       
   101 renameTo:newName
       
   102     "change the name of the class - this writes a change record"
       
   103 
       
   104     |oldName oldSym|
       
   105 
       
   106     oldName := name.
       
   107     oldSym := name asSymbol.
       
   108     self setName:newName.
       
   109 
       
   110     Smalltalk at:oldSym put:nil.
       
   111     Smalltalk removeKey:oldSym.             "26.jun 93"
       
   112     Smalltalk at:(newName asSymbol) put:self.
       
   113 ! !
       
   114 
       
   115 !ClassDescription methodsFor:'private'!
       
   116 
       
   117 addAllInstVarNamesTo:aCollection
       
   118     "helper - add the name-strings of the instance variables and of the inst-vars
       
   119      of all superclasses to the argument, aCollection. Return aCollection"
       
   120 
       
   121     (superclass notNil) ifTrue:[
       
   122         superclass addAllInstVarNamesTo:aCollection
       
   123     ].
       
   124     instvars notNil ifTrue:[
       
   125         aCollection addAll:(instvars asCollectionOfWords).
       
   126     ].
       
   127     ^ aCollection
       
   128 ! !