0
|
1 |
"{ Package: 'stx:goodies/ring' }"
|
|
2 |
|
|
3 |
"{ NameSpace: Smalltalk }"
|
|
4 |
|
|
5 |
RGTraitDescriptionDefinition subclass:#RGTraitDefinition
|
|
6 |
instanceVariableNames:'metaClass comment category package'
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'Ring-Core-Kernel'
|
|
10 |
!
|
|
11 |
|
|
12 |
RGTraitDefinition comment:'RGTraitDefinition is the concrete representation of a trait (no class)'
|
|
13 |
!
|
|
14 |
|
|
15 |
!RGTraitDefinition methodsFor:'accessing'!
|
|
16 |
|
|
17 |
category
|
|
18 |
"Retrieves the tag-package associated to the receiver"
|
|
19 |
|
|
20 |
^category
|
|
21 |
!
|
|
22 |
|
|
23 |
category: aSymbol
|
|
24 |
|
|
25 |
category:= aSymbol
|
|
26 |
!
|
|
27 |
|
|
28 |
classVariables
|
|
29 |
|
|
30 |
^#()
|
|
31 |
!
|
|
32 |
|
|
33 |
comment
|
|
34 |
"Retrieves the comment definition object associated to the receiver"
|
|
35 |
|
|
36 |
^comment
|
|
37 |
!
|
|
38 |
|
|
39 |
comment: anObject
|
|
40 |
"Sets a RGCommentDefinition object based on the argument"
|
|
41 |
|
|
42 |
comment := anObject isRingObject
|
|
43 |
ifFalse: [
|
|
44 |
RGCommentDefinition new
|
|
45 |
parent: self;
|
|
46 |
content: anObject;
|
|
47 |
yourself ]
|
|
48 |
ifTrue: [anObject ]
|
|
49 |
|
|
50 |
!
|
|
51 |
|
|
52 |
instanceVariables
|
|
53 |
|
|
54 |
^#()
|
|
55 |
!
|
|
56 |
|
|
57 |
package
|
|
58 |
"Retrieves the package in which this trait is contained"
|
|
59 |
|
|
60 |
^package
|
|
61 |
!
|
|
62 |
|
|
63 |
package: aRGPackage
|
|
64 |
"Sets the package in which this trait is contained"
|
|
65 |
|
|
66 |
package:= aRGPackage
|
|
67 |
!
|
|
68 |
|
|
69 |
sharedPools
|
|
70 |
|
|
71 |
^#()
|
|
72 |
!
|
|
73 |
|
|
74 |
stamp
|
|
75 |
|
|
76 |
^self hasComment ifTrue:[ self comment stamp ] ifFalse:[ nil ]
|
|
77 |
!
|
|
78 |
|
|
79 |
stamp: aString
|
|
80 |
|
|
81 |
self hasComment
|
|
82 |
ifTrue: [ self comment stamp: aString ]
|
|
83 |
ifFalse:[ RGCommentDefinition new
|
|
84 |
parent: self;
|
|
85 |
stamp: aString ]
|
|
86 |
!
|
|
87 |
|
|
88 |
theMetaClass
|
|
89 |
|
|
90 |
^metaClass
|
|
91 |
!
|
|
92 |
|
|
93 |
theNonMetaClass
|
|
94 |
|
|
95 |
^self
|
|
96 |
! !
|
|
97 |
|
|
98 |
!RGTraitDefinition methodsFor:'behavior'!
|
|
99 |
|
|
100 |
withMetaclass
|
|
101 |
"Registers explicitly the metaclass of a trait"
|
|
102 |
|
|
103 |
metaClass:= RGMetatraitDefinition class: self.
|
|
104 |
!
|
|
105 |
|
|
106 |
withMetaclass: aRGMetatraitDefinition
|
|
107 |
"Registers explicitly the metaclass of a class"
|
|
108 |
|
|
109 |
metaClass:= aRGMetatraitDefinition.
|
|
110 |
metaClass baseClass: self.
|
|
111 |
! !
|
|
112 |
|
|
113 |
!RGTraitDefinition methodsFor:'testing'!
|
|
114 |
|
|
115 |
hasComment
|
|
116 |
|
|
117 |
^comment isEmptyOrNil not
|
|
118 |
!
|
|
119 |
|
|
120 |
hasMetaclass
|
|
121 |
|
|
122 |
^metaClass notNil
|
|
123 |
!
|
|
124 |
|
|
125 |
hasStamp
|
|
126 |
|
|
127 |
^self stamp isEmptyOrNil not
|
|
128 |
!
|
|
129 |
|
|
130 |
isSameRevisionAs: aRGTraitDefinition
|
|
131 |
"This method look for equality of the properties of the receiver"
|
|
132 |
|
|
133 |
^(super isSameRevisionAs: aRGTraitDefinition)
|
|
134 |
and: [ self category = aRGTraitDefinition category
|
|
135 |
and: [ self traitCompositionSource = aRGTraitDefinition traitCompositionSource
|
|
136 |
and: [ ((self hasComment and: [ self comment isSameRevisionAs: aRGTraitDefinition comment ]) or:[ self hasComment not ])
|
|
137 |
and: [ (self theMetaClass isSameRevisionAs: aRGTraitDefinition theMetaClass) ] ] ] ]
|
|
138 |
! !
|
|
139 |
|