GDBObject.st
changeset 35 c17ecf90e446
parent 20 76ac209277a7
child 45 deb908479a37
equal deleted inserted replaced
34:4662b462b28e 35:c17ecf90e446
    36     "Created: / 20-06-2014 / 09:03:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    36     "Created: / 20-06-2014 / 09:03:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    37 !
    37 !
    38 
    38 
    39 getProperty: nm of: object
    39 getProperty: nm of: object
    40 
    40 
    41     | names index properties |
    41     | nmXlated names index properties |
    42 
    42 
    43     index := (names := object class allInstVarNames) indexOf: nm.
    43     nmXlated := (nm includes: $-) ifTrue:[ nm copyReplaceAll: $- with: $_] ifFalse:[ nm ].
       
    44     index := (names := object class allInstVarNames) indexOf: nmXlated.
    44     index ~~ 0 ifTrue:[ 
    45     index ~~ 0 ifTrue:[ 
    45         ^ object instVarAt: index.
    46         ^ object instVarAt: index.
    46     ].
    47     ].
    47     index := names indexOf: #properties.
    48     index := names indexOf: #properties.
    48     index ~~ 0 ifTrue:[ 
    49     index ~~ 0 ifTrue:[ 
    52         ].
    53         ].
    53     ].
    54     ].
    54     ^ nil
    55     ^ nil
    55 
    56 
    56     "Created: / 20-06-2014 / 08:59:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    57     "Created: / 20-06-2014 / 08:59:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    58     "Modified: / 06-09-2014 / 02:05:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    57 !
    59 !
    58 
    60 
    59 setProperty: nm of: object to: value
    61 setProperty: nm of: object to: value
    60 
    62 
    61     | names index properties |
    63     | nmXlated names index properties |
    62 
    64 
    63     index := (names := object class allInstVarNames) indexOf: nm.
    65     nmXlated := (nm includes: $-) ifTrue:[ nm copyReplaceAll: $- with: $_] ifFalse:[ nm ].
       
    66     index := (names := object class allInstVarNames) indexOf: nmXlated.
    64     index ~~ 0 ifTrue:[ 
    67     index ~~ 0 ifTrue:[ 
    65         object instVarAt: index put: value.
    68         object instVarAt: index put: value.
    66 
       
    67     ] ifFalse:[
    69     ] ifFalse:[
    68         index := names indexOf: #properties.
    70         index := names indexOf: #properties.
    69         index ~~ 0 ifTrue:[ 
    71         index ~~ 0 ifTrue:[ 
    70             properties := object instVarAt: index.
    72             properties := object instVarAt: index.
    71             properties isNil ifTrue:[ 
    73             properties isNil ifTrue:[ 
    75             properties at: nm put: value.
    77             properties at: nm put: value.
    76         ].
    78         ].
    77     ].
    79     ].
    78 
    80 
    79     "Created: / 20-06-2014 / 09:01:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    81     "Created: / 20-06-2014 / 09:01:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    82     "Modified (format): / 06-09-2014 / 02:05:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    80 ! !
    83 ! !
    81 
    84 
    82 !GDBObject methodsFor:'accessing-properties'!
    85 !GDBObject methodsFor:'accessing-properties'!
    83 
    86 
    84 properties
    87 properties
    85     ^ GDBObject getPropertiesOf: self.
    88     ^ self class getPropertiesOf: self.
    86 
    89 
    87     "Modified: / 20-06-2014 / 09:04:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    90     "Modified: / 06-09-2014 / 01:49:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    88 !
    91 !
    89 
    92 
    90 propertyAt: name
    93 propertyAt: name
    91     ^ GDBObject getProperty: name of: self
    94     ^ self class getProperty: name of: self
    92 
    95 
    93     "Created: / 31-05-2014 / 00:00:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    96     "Created: / 31-05-2014 / 00:00:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    94     "Modified: / 20-06-2014 / 09:05:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    97     "Modified: / 06-09-2014 / 01:49:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    95 !
    98 !
    96 
    99 
    97 propertyAt: name put: value
   100 propertyAt: name put: value
    98     ^ GDBObject setProperty: name of: self to: value
   101     ^ self class setProperty: name of: self to: value
    99 
   102 
   100     "Created: / 31-05-2014 / 00:01:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   103     "Created: / 31-05-2014 / 00:01:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   101     "Modified: / 20-06-2014 / 09:05:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   104     "Modified: / 06-09-2014 / 01:49:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   102 ! !
   105 ! !
   103 
   106 
   104 !GDBObject methodsFor:'attributes access'!
   107 !GDBObject methodsFor:'attributes access'!
   105 
   108 
   106 objectAttributes
   109 objectAttributes