13403
|
1 |
"
|
13479
|
2 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
|
13403
|
3 |
All Rights Reserved
|
|
4 |
|
13479
|
5 |
Permission is hereby granted, free of charge, to any person
|
|
6 |
obtaining a copy of this software and associated documentation
|
|
7 |
files (the 'Software'), to deal in the Software without
|
|
8 |
restriction, including without limitation the rights to use,
|
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10 |
copies of the Software, and to permit persons to whom the
|
|
11 |
Software is furnished to do so, subject to the following
|
|
12 |
conditions:
|
|
13 |
|
|
14 |
The above copyright notice and this permission notice shall be
|
|
15 |
included in all copies or substantial portions of the Software.
|
|
16 |
|
|
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
24 |
OTHER DEALINGS IN THE SOFTWARE.
|
13403
|
25 |
"
|
|
26 |
"{ Package: 'stx:libbasic' }"
|
|
27 |
|
|
28 |
Object subclass:#Annotation
|
|
29 |
instanceVariableNames:''
|
|
30 |
classVariableNames:''
|
|
31 |
poolDictionaries:''
|
|
32 |
category:'Kernel-Extensions'
|
|
33 |
!
|
|
34 |
|
|
35 |
Annotation subclass:#NameSpace
|
|
36 |
instanceVariableNames:'nameSpace'
|
|
37 |
classVariableNames:''
|
|
38 |
poolDictionaries:''
|
|
39 |
privateIn:Annotation
|
|
40 |
!
|
|
41 |
|
|
42 |
Annotation subclass:#Resource
|
|
43 |
instanceVariableNames:'type value'
|
|
44 |
classVariableNames:''
|
|
45 |
poolDictionaries:''
|
|
46 |
privateIn:Annotation
|
|
47 |
!
|
|
48 |
|
|
49 |
Annotation subclass:#Unknown
|
|
50 |
instanceVariableNames:'key arguments'
|
|
51 |
classVariableNames:''
|
|
52 |
poolDictionaries:''
|
|
53 |
privateIn:Annotation
|
|
54 |
!
|
|
55 |
|
|
56 |
!Annotation class methodsFor:'documentation'!
|
|
57 |
|
|
58 |
copyright
|
|
59 |
"
|
13479
|
60 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
|
13403
|
61 |
All Rights Reserved
|
|
62 |
|
13479
|
63 |
Permission is hereby granted, free of charge, to any person
|
|
64 |
obtaining a copy of this software and associated documentation
|
|
65 |
files (the 'Software'), to deal in the Software without
|
|
66 |
restriction, including without limitation the rights to use,
|
|
67 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
68 |
copies of the Software, and to permit persons to whom the
|
|
69 |
Software is furnished to do so, subject to the following
|
|
70 |
conditions:
|
|
71 |
|
|
72 |
The above copyright notice and this permission notice shall be
|
|
73 |
included in all copies or substantial portions of the Software.
|
|
74 |
|
|
75 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
76 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
77 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
78 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
79 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
80 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
81 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
82 |
OTHER DEALINGS IN THE SOFTWARE.
|
13403
|
83 |
"
|
|
84 |
! !
|
|
85 |
|
|
86 |
!Annotation class methodsFor:'instance creation'!
|
|
87 |
|
|
88 |
key: key arguments: arguments
|
|
89 |
|
|
90 |
^(self respondsTo: key)
|
|
91 |
ifTrue:
|
|
92 |
[self
|
|
93 |
perform: key
|
|
94 |
withArguments: arguments]
|
|
95 |
ifFalse:
|
|
96 |
[Annotation::Unknown new
|
|
97 |
key: key
|
|
98 |
arguments: arguments]
|
|
99 |
|
|
100 |
"Created: / 19-05-2010 / 16:47:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
101 |
"Modified: / 02-07-2010 / 16:22:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
102 |
!
|
|
103 |
|
|
104 |
namespace: aString
|
|
105 |
|
|
106 |
^Annotation::NameSpace new nameSpaceName: aString
|
|
107 |
|
|
108 |
"Created: / 19-05-2010 / 16:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
109 |
!
|
|
110 |
|
|
111 |
resource: type
|
|
112 |
|
|
113 |
^Annotation::Resource new type: type
|
|
114 |
|
|
115 |
"Created: / 16-07-2010 / 11:31:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
116 |
!
|
|
117 |
|
|
118 |
resource: type value: value
|
|
119 |
|
|
120 |
^Annotation::Resource new
|
|
121 |
type: type;
|
|
122 |
value: value
|
|
123 |
|
|
124 |
"Created: / 16-07-2010 / 11:31:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
125 |
! !
|
|
126 |
|
|
127 |
!Annotation methodsFor:'accessing'!
|
|
128 |
|
|
129 |
first
|
|
130 |
|
|
131 |
^self key
|
|
132 |
|
|
133 |
"Created: / 10-07-2010 / 21:38:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
134 |
!
|
|
135 |
|
|
136 |
key
|
|
137 |
|
|
138 |
^self subclassResponsibility
|
|
139 |
|
|
140 |
"Created: / 19-05-2010 / 16:23:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
141 |
"Modified: / 16-07-2010 / 11:29:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
142 |
! !
|
|
143 |
|
|
144 |
!Annotation methodsFor:'printing & storing'!
|
|
145 |
|
|
146 |
printOn:aStream
|
|
147 |
"append a printed representation if the receiver to the argument, aStream"
|
|
148 |
|
|
149 |
self storeOn:aStream.
|
|
150 |
|
|
151 |
"Modified: / 19-05-2010 / 16:25:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
152 |
!
|
|
153 |
|
|
154 |
storeOn:aStream
|
|
155 |
|
|
156 |
self subclassResponsibility
|
|
157 |
|
|
158 |
"Created: / 19-05-2010 / 16:26:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
159 |
! !
|
|
160 |
|
|
161 |
!Annotation methodsFor:'processing'!
|
|
162 |
|
|
163 |
annotatesClass: aClass
|
|
164 |
|
|
165 |
^self subclassResponsibility
|
|
166 |
|
|
167 |
"Created: / 20-05-2010 / 11:15:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
168 |
!
|
|
169 |
|
|
170 |
annotatesMethod: aMethod
|
|
171 |
|
|
172 |
^self subclassResponsibility
|
|
173 |
|
|
174 |
"Created: / 20-05-2010 / 11:15:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
175 |
! !
|
|
176 |
|
|
177 |
!Annotation methodsFor:'testing'!
|
|
178 |
|
|
179 |
isUnknown
|
|
180 |
^ false
|
|
181 |
! !
|
|
182 |
|
|
183 |
!Annotation::NameSpace methodsFor:'accessing'!
|
|
184 |
|
|
185 |
key
|
|
186 |
|
|
187 |
^#namespace:
|
|
188 |
|
|
189 |
"Created: / 19-05-2010 / 16:23:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
190 |
!
|
|
191 |
|
|
192 |
nameSpace
|
|
193 |
^ nameSpace
|
|
194 |
!
|
|
195 |
|
|
196 |
nameSpace:something
|
|
197 |
nameSpace := something.
|
|
198 |
! !
|
|
199 |
|
|
200 |
!Annotation::NameSpace methodsFor:'initialization'!
|
|
201 |
|
|
202 |
nameSpaceName: aString
|
|
203 |
|
|
204 |
self nameSpace: (NameSpace name: aString)
|
|
205 |
|
|
206 |
"Created: / 19-05-2010 / 16:02:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
207 |
! !
|
|
208 |
|
|
209 |
!Annotation::NameSpace methodsFor:'printing & storing'!
|
|
210 |
|
|
211 |
storeOn:aStream
|
|
212 |
"superclass Annotation says that I am responsible to implement this method"
|
|
213 |
|
|
214 |
aStream nextPutAll: '(Annotation namespace: '.
|
|
215 |
nameSpace name storeOn: aStream.
|
|
216 |
aStream nextPut:$)
|
|
217 |
|
|
218 |
"Modified: / 19-05-2010 / 16:27:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
219 |
! !
|
|
220 |
|
|
221 |
!Annotation::NameSpace methodsFor:'processing'!
|
|
222 |
|
|
223 |
annotatesClass:aClass
|
|
224 |
|
|
225 |
"Nothing to do"
|
|
226 |
|
|
227 |
"Modified: / 20-05-2010 / 11:16:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
228 |
!
|
|
229 |
|
|
230 |
annotatesMethod:aMethod
|
|
231 |
|
|
232 |
aMethod lookupObject: NamespaceAwareLookup instance
|
|
233 |
|
|
234 |
"Modified: / 20-05-2010 / 11:18:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
235 |
! !
|
|
236 |
|
|
237 |
!Annotation::Resource methodsFor:'accessing'!
|
|
238 |
|
|
239 |
key
|
|
240 |
"superclass Annotation says that I am responsible to implement this method"
|
|
241 |
|
|
242 |
^value
|
|
243 |
ifNil:[#resource:]
|
|
244 |
ifNotNil:[#resource:value:]
|
|
245 |
|
|
246 |
"Modified: / 16-07-2010 / 11:30:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
247 |
!
|
|
248 |
|
|
249 |
type
|
|
250 |
^ type
|
|
251 |
!
|
|
252 |
|
|
253 |
type:something
|
|
254 |
type := something.
|
|
255 |
!
|
|
256 |
|
|
257 |
value
|
|
258 |
^ value
|
|
259 |
!
|
|
260 |
|
|
261 |
value:something
|
|
262 |
value := something.
|
|
263 |
! !
|
|
264 |
|
|
265 |
!Annotation::Resource methodsFor:'printing & storing'!
|
|
266 |
|
|
267 |
storeOn:aStream
|
|
268 |
|
|
269 |
aStream nextPutAll: '(Annotation resource: '.
|
|
270 |
type storeOn: aStream.
|
|
271 |
value ifNotNil:
|
|
272 |
[aStream nextPutAll: ' value: '.
|
|
273 |
value storeOn: aStream].
|
|
274 |
aStream nextPut:$)
|
|
275 |
|
|
276 |
"Modified: / 16-07-2010 / 11:36:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
277 |
! !
|
|
278 |
|
|
279 |
!Annotation::Resource methodsFor:'processing'!
|
|
280 |
|
|
281 |
annotatesClass:aClass
|
|
282 |
|
|
283 |
"Nothing to do"
|
|
284 |
|
|
285 |
"Modified: / 16-07-2010 / 11:28:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
286 |
!
|
|
287 |
|
|
288 |
annotatesMethod:aMethod
|
|
289 |
|
|
290 |
"Nothing to do"
|
|
291 |
|
|
292 |
"Modified: / 16-07-2010 / 11:28:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
293 |
! !
|
|
294 |
|
|
295 |
!Annotation::Unknown methodsFor:'accessing'!
|
|
296 |
|
|
297 |
arguments
|
|
298 |
^ arguments
|
|
299 |
!
|
|
300 |
|
|
301 |
key
|
|
302 |
^ key
|
|
303 |
! !
|
|
304 |
|
|
305 |
!Annotation::Unknown methodsFor:'initialization'!
|
|
306 |
|
|
307 |
key:keyArg arguments:argumentsArg
|
|
308 |
key := keyArg.
|
|
309 |
arguments := argumentsArg.
|
|
310 |
! !
|
|
311 |
|
|
312 |
!Annotation::Unknown methodsFor:'printing & storing'!
|
|
313 |
|
|
314 |
storeOn:aStream
|
|
315 |
"superclass Annotation says that I am responsible to implement this method"
|
|
316 |
|
|
317 |
aStream nextPutAll: '(Annotation key: '.
|
|
318 |
key storeOn: aStream.
|
|
319 |
aStream nextPutAll: ' arguments: '.
|
|
320 |
arguments storeOn: aStream.
|
|
321 |
aStream nextPut: $).
|
|
322 |
|
|
323 |
"Modified: / 19-05-2010 / 16:46:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
324 |
! !
|
|
325 |
|
|
326 |
!Annotation::Unknown methodsFor:'processing'!
|
|
327 |
|
|
328 |
annotatesClass:aClass
|
|
329 |
|
|
330 |
"Nothing to do"
|
|
331 |
|
|
332 |
"Modified: / 20-05-2010 / 11:15:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
333 |
!
|
|
334 |
|
|
335 |
annotatesMethod:aMethod
|
|
336 |
|
|
337 |
"Nothing to do"
|
|
338 |
|
|
339 |
"Modified: / 20-05-2010 / 11:15:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
340 |
! !
|
|
341 |
|
|
342 |
!Annotation::Unknown methodsFor:'testing'!
|
|
343 |
|
|
344 |
isUnknown
|
|
345 |
^ true
|
|
346 |
! !
|
|
347 |
|
|
348 |
!Annotation class methodsFor:'documentation'!
|
|
349 |
|
13479
|
350 |
version_CVS
|
|
351 |
^ '$Header: /cvs/stx/stx/libbasic/Annotation.st,v 1.2 2011-07-03 15:00:45 cg Exp $'
|
|
352 |
!
|
|
353 |
|
13403
|
354 |
version_SVN
|
13479
|
355 |
^ '§Id: Annotation.st,v 1.1 2011/06/28 11:04:04 vrany Exp §'
|
13403
|
356 |
! !
|