author | Stefan Vogel <sv@exept.de> |
Mon, 02 Apr 2007 12:13:23 +0200 | |
changeset 2030 | 6f213151b826 |
parent 2006 | a5996b7ad0cf |
child 2186 | 7af603c810b7 |
permissions | -rw-r--r-- |
283 | 1 |
" |
2 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1129 | 12 |
"{ Package: 'stx:libcomp' }" |
13 |
||
282 | 14 |
Object subclass:#Structure |
1424 | 15 |
instanceVariableNames:'superclass flags methodDictionary instSize i1 i2 i3 i4 i5 i6 i7 |
16 |
i8 i9 i10 i11 i12 i13 i14 i15 i16 i17 i18 i19 i20 i21 i22 i23 i24 |
|
17 |
i25 i26 i27 i28 i29 i30 i31 i32 i33 i34 i35 i36 i37 i38 i39 i40 |
|
18 |
i41 i42 i43 i44 i45 i46 i47 i48 i49 i50' |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
19 |
classVariableNames:'OneInstance DummyClass ReadAccessMethods WriteAccessMethods |
616 | 20 |
OtherMethods OtherSelectors' |
282 | 21 |
poolDictionaries:'' |
283 | 22 |
category:'Programming-Support' |
282 | 23 |
! |
24 |
||
616 | 25 |
!Structure class methodsFor:'documentation'! |
282 | 26 |
|
283 | 27 |
copyright |
28 |
" |
|
29 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
282 | 41 |
documentation |
42 |
" |
|
616 | 43 |
This is an experimental class, stressing the metaObject capabilities. |
282 | 44 |
|
616 | 45 |
Structures are objects which are class-less, |
46 |
only holding some values, and provide a protocol to access |
|
47 |
those fields. In addition, they support the array-protocol, |
|
48 |
so they can be used as backward compatible replacements in |
|
282 | 49 |
places where arrays were returned. |
616 | 50 |
(However, we recommend using private classes, since they are easier |
1037 | 51 |
to understand and maintain). |
616 | 52 |
|
53 |
For example, some structure object can be create with: |
|
54 |
^ Structure with:#foo->'someFooValue' with:#bar->'someBarValue' |
|
282 | 55 |
|
56 |
and access these values either as: |
|
616 | 57 |
retVal at:1 -> returns the foo instvar value |
58 |
retVal at:2 -> returns the bar instvar value |
|
282 | 59 |
or (much more convenient and readable) as: |
616 | 60 |
retVal foo |
61 |
retVal bar |
|
282 | 62 |
|
616 | 63 |
Implementation note: |
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
64 |
this is a very tricky (but fully legal) implementation, |
616 | 65 |
creating an object which is its own class. |
66 |
Therefore, no additional overhead by extra (class) objects is involved. |
|
67 |
These are very lightweight objects. |
|
68 |
||
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
69 |
Another prove that smalltalk is a powerful & flexible programming language. |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
70 |
However, some smalltalk systems crash if your try this ;-) |
282 | 71 |
|
343 | 72 |
CAVEAT: |
616 | 73 |
tricky implementation - not the full object protocol is supported; |
343 | 74 |
a maximum of 50 instance variables is allowed. |
75 |
||
616 | 76 |
[WARNING:] |
77 |
this is an experimental goody - for our amusement and not meant |
|
78 |
to be used in real applications. |
|
79 |
It may be removed without notice and/or no longer maintained in the furure. |
|
80 |
||
282 | 81 |
[author:] |
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
82 |
Claus Gittinger |
282 | 83 |
|
84 |
[see also:] |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
85 |
Array |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
86 |
Behavior |
282 | 87 |
" |
88 |
! |
|
89 |
||
90 |
examples |
|
91 |
" |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
92 |
access is possibly by name: |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
93 |
[exBegin] |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
94 |
Transcript showCR: |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
95 |
(Structure with:#foo->'foo value') foo |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
96 |
[exEnd] |
282 | 97 |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
98 |
AND also by index (for backward compatibility): |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
99 |
[exBegin] |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
100 |
Transcript showCR: |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
101 |
((Structure with:#foo->'foo value') at:1) |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
102 |
[exEnd] |
282 | 103 |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
104 |
it can be inspected: |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
105 |
[exBegin] |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
106 |
(Structure with:#foo->'foo value') inspect |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
107 |
[exEnd] |
282 | 108 |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
109 |
and presents its contents nicely: |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
110 |
[exBegin] |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
111 |
(Structure with:#foo->'foo value' with:#bar->'bar value') inspect |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
112 |
[exEnd] |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
113 |
|
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
114 |
[exBegin] |
282 | 115 |
(Structure with:#foo->'hello' with:#bar->true with:#baz->'world') inspect |
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
116 |
[exEnd] |
282 | 117 |
|
118 |
" |
|
119 |
! ! |
|
120 |
||
616 | 121 |
!Structure class methodsFor:'initialization'! |
282 | 122 |
|
123 |
initialize |
|
124 |
OneInstance isNil ifTrue:[ |
|
1424 | 125 |
Behavior instSize ~~ 4 ifTrue:[ |
126 |
self halt:'must change definition of this class'. |
|
127 |
]. |
|
128 |
||
282 | 129 |
OneInstance := self basicNew. |
130 |
||
131 |
DummyClass := Behavior shallowCopy. |
|
132 |
DummyClass flags:(Behavior flagBehavior bitOr:Behavior flagPointers). |
|
953 | 133 |
DummyClass setName:#DummyClass. |
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
134 |
|
343 | 135 |
ReadAccessMethods := (1 to:50) |
616 | 136 |
collect:[:i | |m| |
137 |
m := self compiledMethodAt:('i', i printString) asSymbol. |
|
138 |
(m notNil and:[m isLazyMethod]) ifTrue:[m makeRealMethod]. |
|
139 |
m |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
140 |
]. |
343 | 141 |
WriteAccessMethods := (1 to:50) |
616 | 142 |
collect:[:i | |m| |
143 |
m := self compiledMethodAt:('i', i printString , ':') asSymbol. |
|
144 |
(m notNil and:[m isLazyMethod]) ifTrue:[m makeRealMethod]. |
|
145 |
m |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
146 |
]. |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
147 |
|
616 | 148 |
OtherMethods := OrderedCollection new. |
149 |
OtherMethods |
|
150 |
add:(self compiledMethodAt:#doesNotUnderstand:); |
|
151 |
add:(Object compiledMethodAt:#class); |
|
152 |
add:(Object compiledMethodAt:#identityHash); |
|
153 |
add:(Object compiledMethodAt:#at:); |
|
154 |
add:(Object compiledMethodAt:#at:put:); |
|
155 |
add:(Object compiledMethodAt:#basicAt:); |
|
156 |
add:(Object compiledMethodAt:#basicAt:put:); |
|
157 |
add:(Object compiledMethodAt:#printString); |
|
158 |
add:(Object compiledMethodAt:#printOn:); |
|
159 |
add:(Object compiledMethodAt:#addDependent:); |
|
160 |
add:(Object compiledMethodAt:#removeDependent:); |
|
161 |
add:(Object compiledMethodAt:#dependents); |
|
162 |
add:(Object compiledMethodAt:#dependents:); |
|
163 |
add:(Object compiledMethodAt:#perform:); |
|
164 |
add:(Object compiledMethodAt:#perform:with:). |
|
165 |
OtherMethods := OtherMethods asArray. |
|
166 |
||
167 |
OtherSelectors := #(#doesNotUnderstand: |
|
168 |
#class #identityHash |
|
169 |
#at: #at:put: #basicAt: #basicAt:put: |
|
170 |
#printString #printOn: |
|
171 |
#addDependent: #removeDependent: #dependents #dependents: |
|
172 |
#perform: #perform:with:). |
|
282 | 173 |
]. |
174 |
||
175 |
" |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
176 |
OneInstance := nil. |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
177 |
self initialize. |
282 | 178 |
" |
179 |
||
343 | 180 |
"Modified: 21.9.1996 / 16:01:48 / cg" |
282 | 181 |
! ! |
182 |
||
616 | 183 |
!Structure class methodsFor:'instance creation'! |
282 | 184 |
|
185 |
newWith:names |
|
186 |
"return a new structure containing fields as passed in the names collection. |
|
187 |
The argument must be a sequenceable collection of symbols. |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
188 |
The new structures values are all initialized to nil." |
282 | 189 |
|
190 |
^ self newWith:names values:nil |
|
191 |
||
192 |
" |
|
193 |
Structure newWith:#(foo bar) |
|
194 |
" |
|
195 |
||
196 |
"Created: 13.5.1996 / 20:03:42 / cg" |
|
197 |
! |
|
198 |
||
199 |
newWith:names values:values |
|
200 |
"return a new structure containing fields as passed in the names collection. |
|
201 |
The argument must be a sequenceable collection of symbols. |
|
202 |
The new structures values are set to corresponding values from the second argument, values." |
|
203 |
||
1424 | 204 |
|arr sels mthds nInsts behviorsInstSize| |
616 | 205 |
|
206 |
nInsts := names size. |
|
282 | 207 |
|
208 |
sels := names collect:[:nm | nm asSymbol]. |
|
209 |
sels := sels , (names collect:[:nm | (nm , ':') asSymbol]). |
|
616 | 210 |
sels := sels , OtherSelectors. |
282 | 211 |
|
616 | 212 |
mthds := ReadAccessMethods copyTo:nInsts. |
213 |
mthds := mthds , (WriteAccessMethods copyTo:nInsts). |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
214 |
mthds := mthds , OtherMethods. |
282 | 215 |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
216 |
"/ create a prototype object as an array ... |
616 | 217 |
"/ the object will be its own class, and have the indexable flag bit set; |
1424 | 218 |
"/ therefore, the first behviorsInstSize instVars must correspond to Behavior instvars, |
616 | 219 |
"/ the remaining ones will be the indexed instvars. |
1424 | 220 |
behviorsInstSize := Behavior instSize. |
282 | 221 |
|
1424 | 222 |
arr := Array new:(behviorsInstSize + nInsts). |
282 | 223 |
arr at:1 put:nil. "/ superclass |
224 |
arr at:2 put:(Behavior flagBehavior bitOr:Behavior flagPointers). "/ flags |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
225 |
arr at:3 put:(MethodDictionary withKeys:sels andValues:mthds). "/ selectors & methods |
1424 | 226 |
arr at:4 put:behviorsInstSize. "/ instSize |
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
227 |
|
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
228 |
"/ now, the big trick ... |
282 | 229 |
|
230 |
arr changeClassTo:DummyClass. |
|
231 |
arr changeClassTo:arr. |
|
232 |
||
233 |
values notNil ifTrue:[ |
|
234 |
values keysAndValuesDo:[:i :val | |
|
235 |
arr at:i put:val |
|
236 |
] |
|
237 |
]. |
|
238 |
||
239 |
^ arr. |
|
240 |
||
241 |
" |
|
242 |
Structure newWith:#(foo bar) values:#('foo' 'bar') |
|
243 |
" |
|
244 |
||
245 |
"Created: 13.5.1996 / 20:03:42 / cg" |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
246 |
"Modified: 3.7.1996 / 10:24:43 / cg" |
282 | 247 |
! |
248 |
||
249 |
with:assoc |
|
250 |
"return a new structure with a single field, named to the assocs key, |
|
251 |
and initialized with assocs value." |
|
252 |
||
253 |
^ self newWith:(Array with:assoc key) values:(Array with:assoc value) |
|
254 |
||
255 |
" |
|
256 |
Structure with:#foo->'foo' |
|
257 |
" |
|
258 |
! |
|
259 |
||
260 |
with:assoc1 with:assoc2 |
|
261 |
"return a new structure with two fields, named as defined by the arguments' |
|
262 |
keys, and and initialized with the assocs' values." |
|
263 |
||
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
264 |
^ self newWith:(Array with:assoc1 key with:assoc2 key) |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
265 |
values:(Array with:assoc1 value with:assoc2 value) |
282 | 266 |
|
267 |
" |
|
268 |
Structure with:#foo->'foo' with:#bar->'bar' |
|
269 |
" |
|
270 |
! |
|
271 |
||
272 |
with:assoc1 with:assoc2 with:assoc3 |
|
273 |
"return a new structure with three fields, named as defined by the arguments' |
|
274 |
keys, and and initialized with the assocs' values." |
|
275 |
||
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
276 |
^ self newWith:(Array with:assoc1 key with:assoc2 key with:assoc3 key) |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
277 |
values:(Array with:assoc1 value with:assoc2 value with:assoc3 value) |
282 | 278 |
|
279 |
" |
|
280 |
Structure with:#foo->'foo' with:#bar->'bar' with:#baz->'baz' |
|
281 |
" |
|
282 |
! |
|
283 |
||
284 |
with:assoc1 with:assoc2 with:assoc3 with:assoc4 |
|
285 |
"return a new structure with four fields, named as defined by the arguments' |
|
286 |
keys, and and initialized with the assocs' values." |
|
287 |
||
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
288 |
^ self newWith:(Array with:assoc1 key with:assoc2 key |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
289 |
with:assoc3 key with:assoc4 key) |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
290 |
values:(Array with:assoc1 value with:assoc2 value |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
291 |
with:assoc3 value with:assoc4 value) |
282 | 292 |
|
293 |
" |
|
294 |
Structure with:#foo->'foo' with:#bar->'bar' with:#baz->'baz' with:#hello->'hello' |
|
295 |
" |
|
296 |
! |
|
297 |
||
298 |
with:assoc1 with:assoc2 with:assoc3 with:assoc4 with:assoc5 |
|
299 |
"return a new structure with five fields, named as defined by the arguments' |
|
300 |
keys, and and initialized with the assocs' values." |
|
301 |
||
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
302 |
^ self newWith:(Array with:assoc1 key with:assoc2 key |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
303 |
with:assoc3 key with:assoc4 key |
282 | 304 |
with:assoc5 key) |
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
305 |
values:(Array with:assoc1 value with:assoc2 value |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
306 |
with:assoc3 value with:assoc4 value |
282 | 307 |
with:assoc5 value) |
308 |
||
309 |
" |
|
310 |
Structure with:#foo->'foo' with:#bar->'bar' with:#baz->'baz' with:#hello->'hello' with:#world->'world' |
|
311 |
" |
|
1131 | 312 |
! |
313 |
||
314 |
with:assoc1 with:assoc2 with:assoc3 with:assoc4 with:assoc5 with:assoc6 |
|
315 |
"return a new structure with five fields, named as defined by the arguments' |
|
316 |
keys, and and initialized with the assocs' values." |
|
317 |
||
318 |
^ self newWith:(Array with:assoc1 key with:assoc2 key |
|
319 |
with:assoc3 key with:assoc4 key |
|
320 |
with:assoc5 key with:assoc6 key) |
|
321 |
values:(Array with:assoc1 value with:assoc2 value |
|
322 |
with:assoc3 value with:assoc4 value |
|
323 |
with:assoc5 value with:assoc6 value) |
|
324 |
||
325 |
" |
|
326 |
Structure with:#foo->'foo' with:#bar->'bar' with:#baz->'baz' with:#hello->'hello' with:#world->'world' |
|
327 |
" |
|
328 |
! |
|
329 |
||
330 |
with:assoc1 with:assoc2 with:assoc3 with:assoc4 with:assoc5 with:assoc6 with:assoc7 |
|
331 |
"return a new structure with five fields, named as defined by the arguments' |
|
332 |
keys, and and initialized with the assocs' values." |
|
333 |
||
334 |
^ self newWith:(Array with:assoc1 key with:assoc2 key |
|
335 |
with:assoc3 key with:assoc4 key |
|
336 |
with:assoc5 key with:assoc6 key |
|
337 |
with:assoc7 key) |
|
338 |
values:(Array with:assoc1 value with:assoc2 value |
|
339 |
with:assoc3 value with:assoc4 value |
|
340 |
with:assoc5 value with:assoc6 value |
|
341 |
with:assoc7 value) |
|
342 |
||
343 |
" |
|
344 |
Structure with:#foo->'foo' with:#bar->'bar' with:#baz->'baz' with:#hello->'hello' with:#world->'world' |
|
345 |
" |
|
282 | 346 |
! ! |
347 |
||
616 | 348 |
!Structure class methodsFor:'special'! |
349 |
||
350 |
primAddSelector:newSelector withMethod:newMethod |
|
351 |
"must reinit myself when methods are accepted." |
|
352 |
||
353 |
|val| |
|
354 |
||
355 |
val := super primAddSelector:newSelector withMethod:newMethod. |
|
356 |
OneInstance := nil. |
|
357 |
self initialize. |
|
358 |
^ val |
|
359 |
! ! |
|
360 |
||
282 | 361 |
!Structure methodsFor:'accessing'! |
362 |
||
363 |
flags |
|
364 |
"return the flags - required class protocol" |
|
365 |
||
366 |
^ flags |
|
367 |
||
368 |
"Created: 13.5.1996 / 21:19:23 / cg" |
|
369 |
! |
|
370 |
||
371 |
flags:something |
|
372 |
"set the flags - required class protocol" |
|
373 |
||
374 |
flags := something. |
|
375 |
||
376 |
"Created: 13.5.1996 / 21:19:23 / cg" |
|
377 |
! |
|
378 |
||
379 |
i1 |
|
616 | 380 |
"prototype method to return the first instance variable" |
282 | 381 |
|
382 |
^ i1 |
|
383 |
||
384 |
"Created: 13.5.1996 / 21:19:25 / cg" |
|
385 |
! |
|
386 |
||
387 |
i10 |
|
616 | 388 |
"prototype method to return the 10th instance variable" |
282 | 389 |
|
390 |
^ i10 |
|
391 |
||
392 |
"Created: 13.5.1996 / 21:19:27 / cg" |
|
393 |
! |
|
394 |
||
395 |
i10:something |
|
616 | 396 |
"prototype method to set the 10th instance variable" |
282 | 397 |
|
398 |
i10 := something. |
|
399 |
||
400 |
"Created: 13.5.1996 / 21:19:27 / cg" |
|
401 |
! |
|
402 |
||
403 |
i11 |
|
404 |
"return i11" |
|
405 |
||
406 |
^ i11 |
|
407 |
||
408 |
"Created: 13.5.1996 / 21:19:27 / cg" |
|
409 |
! |
|
410 |
||
411 |
i11:something |
|
616 | 412 |
"prototype method to set the 11th instance variable" |
282 | 413 |
|
414 |
i11 := something. |
|
415 |
||
416 |
"Created: 13.5.1996 / 21:19:27 / cg" |
|
417 |
! |
|
418 |
||
419 |
i12 |
|
420 |
"return i12" |
|
421 |
||
422 |
^ i12 |
|
423 |
||
424 |
"Created: 13.5.1996 / 21:19:27 / cg" |
|
425 |
! |
|
426 |
||
427 |
i12:something |
|
428 |
"set i12" |
|
429 |
||
430 |
i12 := something. |
|
431 |
||
432 |
"Created: 13.5.1996 / 21:19:27 / cg" |
|
433 |
! |
|
434 |
||
435 |
i13 |
|
436 |
"return i13" |
|
437 |
||
438 |
^ i13 |
|
439 |
||
440 |
"Created: 13.5.1996 / 21:19:28 / cg" |
|
441 |
! |
|
442 |
||
443 |
i13:something |
|
444 |
"set i13" |
|
445 |
||
446 |
i13 := something. |
|
447 |
||
448 |
"Created: 13.5.1996 / 21:19:28 / cg" |
|
449 |
! |
|
450 |
||
451 |
i14 |
|
452 |
"return i14" |
|
453 |
||
454 |
^ i14 |
|
455 |
||
456 |
"Created: 13.5.1996 / 21:19:28 / cg" |
|
457 |
! |
|
458 |
||
459 |
i14:something |
|
460 |
"set i14" |
|
461 |
||
462 |
i14 := something. |
|
463 |
||
464 |
"Created: 13.5.1996 / 21:19:28 / cg" |
|
465 |
! |
|
466 |
||
467 |
i15 |
|
468 |
"return i15" |
|
469 |
||
470 |
^ i15 |
|
471 |
||
472 |
"Created: 13.5.1996 / 21:19:28 / cg" |
|
473 |
! |
|
474 |
||
475 |
i15:something |
|
476 |
"set i15" |
|
477 |
||
478 |
i15 := something. |
|
479 |
||
480 |
"Created: 13.5.1996 / 21:19:28 / cg" |
|
481 |
! |
|
482 |
||
483 |
i16 |
|
484 |
"return i16" |
|
485 |
||
486 |
^ i16 |
|
487 |
||
488 |
"Created: 13.5.1996 / 21:19:28 / cg" |
|
489 |
! |
|
490 |
||
491 |
i16:something |
|
492 |
"set i16" |
|
493 |
||
494 |
i16 := something. |
|
495 |
||
496 |
"Created: 13.5.1996 / 21:19:28 / cg" |
|
497 |
! |
|
498 |
||
499 |
i17 |
|
500 |
"return i17" |
|
501 |
||
502 |
^ i17 |
|
503 |
||
504 |
"Created: 13.5.1996 / 21:19:28 / cg" |
|
505 |
! |
|
506 |
||
507 |
i17:something |
|
508 |
"set i17" |
|
509 |
||
510 |
i17 := something. |
|
511 |
||
512 |
"Created: 13.5.1996 / 21:19:29 / cg" |
|
513 |
! |
|
514 |
||
515 |
i18 |
|
516 |
"return i18" |
|
517 |
||
518 |
^ i18 |
|
519 |
||
520 |
"Created: 13.5.1996 / 21:19:29 / cg" |
|
521 |
! |
|
522 |
||
523 |
i18:something |
|
524 |
"set i18" |
|
525 |
||
526 |
i18 := something. |
|
527 |
||
528 |
"Created: 13.5.1996 / 21:19:29 / cg" |
|
529 |
! |
|
530 |
||
531 |
i19 |
|
532 |
"return i19" |
|
533 |
||
534 |
^ i19 |
|
535 |
||
536 |
"Created: 13.5.1996 / 21:19:29 / cg" |
|
537 |
! |
|
538 |
||
539 |
i19:something |
|
540 |
"set i19" |
|
541 |
||
542 |
i19 := something. |
|
543 |
||
544 |
"Created: 13.5.1996 / 21:19:29 / cg" |
|
545 |
! |
|
546 |
||
547 |
i1:something |
|
616 | 548 |
"prototype method to set the 1st instance variable" |
282 | 549 |
|
550 |
i1 := something. |
|
551 |
||
552 |
"Created: 13.5.1996 / 21:19:25 / cg" |
|
553 |
! |
|
554 |
||
555 |
i2 |
|
616 | 556 |
"prototype method to return the 2nd instance variable" |
282 | 557 |
|
558 |
^ i2 |
|
559 |
||
560 |
"Created: 13.5.1996 / 21:19:25 / cg" |
|
561 |
! |
|
562 |
||
563 |
i20 |
|
564 |
"return i20" |
|
565 |
||
566 |
^ i20 |
|
567 |
||
568 |
"Created: 13.5.1996 / 21:19:29 / cg" |
|
569 |
! |
|
570 |
||
571 |
i20:something |
|
572 |
"set i20" |
|
573 |
||
574 |
i20 := something. |
|
575 |
||
576 |
"Created: 13.5.1996 / 21:19:29 / cg" |
|
577 |
! |
|
578 |
||
343 | 579 |
i21 |
580 |
"return i21" |
|
581 |
||
582 |
^ i21 |
|
583 |
||
584 |
"Created: 21.9.1996 / 16:06:21 / cg" |
|
585 |
! |
|
586 |
||
587 |
i21:something |
|
588 |
"set i21" |
|
589 |
||
590 |
i21 := something. |
|
591 |
||
592 |
"Created: 21.9.1996 / 16:06:21 / cg" |
|
593 |
! |
|
594 |
||
595 |
i22 |
|
596 |
"return i22" |
|
597 |
||
598 |
^ i22 |
|
599 |
||
600 |
"Created: 21.9.1996 / 16:06:21 / cg" |
|
601 |
! |
|
602 |
||
603 |
i22:something |
|
604 |
"set i22" |
|
605 |
||
606 |
i22 := something. |
|
607 |
||
608 |
"Created: 21.9.1996 / 16:06:21 / cg" |
|
609 |
! |
|
610 |
||
611 |
i23 |
|
612 |
"return i23" |
|
613 |
||
614 |
^ i23 |
|
615 |
||
616 |
"Created: 21.9.1996 / 16:06:21 / cg" |
|
617 |
! |
|
618 |
||
619 |
i23:something |
|
620 |
"set i23" |
|
621 |
||
622 |
i23 := something. |
|
623 |
||
624 |
"Created: 21.9.1996 / 16:06:21 / cg" |
|
625 |
! |
|
626 |
||
627 |
i24 |
|
628 |
"return i24" |
|
629 |
||
630 |
^ i24 |
|
631 |
||
632 |
"Created: 21.9.1996 / 16:06:21 / cg" |
|
633 |
! |
|
634 |
||
635 |
i24:something |
|
636 |
"set i24" |
|
637 |
||
638 |
i24 := something. |
|
639 |
||
640 |
"Created: 21.9.1996 / 16:06:21 / cg" |
|
641 |
! |
|
642 |
||
643 |
i25 |
|
644 |
"return i25" |
|
645 |
||
646 |
^ i25 |
|
647 |
||
648 |
"Created: 21.9.1996 / 16:06:21 / cg" |
|
649 |
! |
|
650 |
||
651 |
i25:something |
|
652 |
"set i25" |
|
653 |
||
654 |
i25 := something. |
|
655 |
||
656 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
657 |
! |
|
658 |
||
659 |
i26 |
|
660 |
"return i26" |
|
661 |
||
662 |
^ i26 |
|
663 |
||
664 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
665 |
! |
|
666 |
||
667 |
i26:something |
|
668 |
"set i26" |
|
669 |
||
670 |
i26 := something. |
|
671 |
||
672 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
673 |
! |
|
674 |
||
675 |
i27 |
|
676 |
"return i27" |
|
677 |
||
678 |
^ i27 |
|
679 |
||
680 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
681 |
! |
|
682 |
||
683 |
i27:something |
|
684 |
"set i27" |
|
685 |
||
686 |
i27 := something. |
|
687 |
||
688 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
689 |
! |
|
690 |
||
691 |
i28 |
|
692 |
"return i28" |
|
693 |
||
694 |
^ i28 |
|
695 |
||
696 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
697 |
! |
|
698 |
||
699 |
i28:something |
|
700 |
"set i28" |
|
701 |
||
702 |
i28 := something. |
|
703 |
||
704 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
705 |
! |
|
706 |
||
707 |
i29 |
|
708 |
"return i29" |
|
709 |
||
710 |
^ i29 |
|
711 |
||
712 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
713 |
! |
|
714 |
||
715 |
i29:something |
|
716 |
"set i29" |
|
717 |
||
718 |
i29 := something. |
|
719 |
||
720 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
721 |
! |
|
722 |
||
282 | 723 |
i2:something |
616 | 724 |
"prototype method to set the 2nd instance variable" |
282 | 725 |
|
726 |
i2 := something. |
|
727 |
||
728 |
"Created: 13.5.1996 / 21:19:25 / cg" |
|
729 |
! |
|
730 |
||
731 |
i3 |
|
616 | 732 |
"prototype method to return the 3rd instance variable" |
282 | 733 |
|
734 |
^ i3 |
|
735 |
||
736 |
"Created: 13.5.1996 / 21:19:25 / cg" |
|
737 |
! |
|
738 |
||
343 | 739 |
i30:something |
740 |
"set i30" |
|
741 |
||
742 |
i30 := something. |
|
743 |
||
744 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
745 |
! |
|
746 |
||
747 |
i31 |
|
748 |
"return i31" |
|
749 |
||
750 |
^ i31 |
|
751 |
||
752 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
753 |
! |
|
754 |
||
755 |
i31:something |
|
756 |
"set i31" |
|
757 |
||
758 |
i31 := something. |
|
759 |
||
760 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
761 |
! |
|
762 |
||
763 |
i32 |
|
764 |
"return i32" |
|
765 |
||
766 |
^ i32 |
|
767 |
||
768 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
769 |
! |
|
770 |
||
771 |
i32:something |
|
772 |
"set i32" |
|
773 |
||
774 |
i32 := something. |
|
775 |
||
776 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
777 |
! |
|
778 |
||
779 |
i33 |
|
780 |
"return i33" |
|
781 |
||
782 |
^ i33 |
|
783 |
||
784 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
785 |
! |
|
786 |
||
787 |
i33:something |
|
788 |
"set i33" |
|
789 |
||
790 |
i33 := something. |
|
791 |
||
792 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
793 |
! |
|
794 |
||
795 |
i34 |
|
796 |
"return i34" |
|
797 |
||
798 |
^ i34 |
|
799 |
||
800 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
801 |
! |
|
802 |
||
803 |
i34:something |
|
804 |
"set i34" |
|
805 |
||
806 |
i34 := something. |
|
807 |
||
808 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
809 |
! |
|
810 |
||
811 |
i35 |
|
812 |
"return i35" |
|
813 |
||
814 |
^ i35 |
|
815 |
||
816 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
817 |
! |
|
818 |
||
819 |
i35:something |
|
820 |
"set i35" |
|
821 |
||
822 |
i35 := something. |
|
823 |
||
824 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
825 |
! |
|
826 |
||
827 |
i36 |
|
828 |
"return i36" |
|
829 |
||
830 |
^ i36 |
|
831 |
||
832 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
833 |
! |
|
834 |
||
835 |
i36:something |
|
836 |
"set i36" |
|
837 |
||
838 |
i36 := something. |
|
839 |
||
840 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
841 |
! |
|
842 |
||
843 |
i37 |
|
844 |
"return i37" |
|
845 |
||
846 |
^ i37 |
|
847 |
||
848 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
849 |
! |
|
850 |
||
851 |
i37:something |
|
852 |
"set i37" |
|
853 |
||
854 |
i37 := something. |
|
855 |
||
856 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
857 |
! |
|
858 |
||
859 |
i38 |
|
860 |
"return i38" |
|
861 |
||
862 |
^ i38 |
|
863 |
||
864 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
865 |
! |
|
866 |
||
867 |
i38:something |
|
868 |
"set i38" |
|
869 |
||
870 |
i38 := something. |
|
871 |
||
872 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
873 |
! |
|
874 |
||
875 |
i39 |
|
876 |
"return i39" |
|
877 |
||
878 |
^ i39 |
|
879 |
||
880 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
881 |
! |
|
882 |
||
883 |
i39:something |
|
884 |
"set i39" |
|
885 |
||
886 |
i39 := something. |
|
887 |
||
888 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
889 |
! |
|
890 |
||
282 | 891 |
i3:something |
616 | 892 |
"prototype method to set the 3rd instance variable" |
282 | 893 |
|
894 |
i3 := something. |
|
895 |
||
896 |
"Created: 13.5.1996 / 21:19:25 / cg" |
|
897 |
! |
|
898 |
||
899 |
i4 |
|
616 | 900 |
"prototype method to return the 4th instance variable" |
282 | 901 |
|
902 |
^ i4 |
|
903 |
||
904 |
"Created: 13.5.1996 / 21:19:25 / cg" |
|
905 |
! |
|
906 |
||
616 | 907 |
i40 |
908 |
"return the value of the instance variable 'i40' (automatically generated)" |
|
909 |
||
1129 | 910 |
^ i40 |
911 |
! |
|
616 | 912 |
|
343 | 913 |
i40:something |
616 | 914 |
"prototype method" |
343 | 915 |
|
916 |
i40 := something. |
|
917 |
||
918 |
"Created: 21.9.1996 / 16:06:22 / cg" |
|
919 |
! |
|
920 |
||
921 |
i41 |
|
616 | 922 |
"prototype method" |
343 | 923 |
|
924 |
^ i41 |
|
925 |
||
926 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
927 |
! |
|
928 |
||
929 |
i41:something |
|
616 | 930 |
"prototype method" |
343 | 931 |
|
932 |
i41 := something. |
|
933 |
||
934 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
935 |
! |
|
936 |
||
937 |
i42 |
|
616 | 938 |
"prototype method" |
343 | 939 |
|
940 |
^ i42 |
|
941 |
||
942 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
943 |
! |
|
944 |
||
945 |
i42:something |
|
616 | 946 |
"prototype method" |
343 | 947 |
|
948 |
i42 := something. |
|
949 |
||
950 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
951 |
! |
|
952 |
||
953 |
i43 |
|
616 | 954 |
"prototype method" |
343 | 955 |
|
956 |
^ i43 |
|
957 |
||
958 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
959 |
! |
|
960 |
||
961 |
i43:something |
|
616 | 962 |
"prototype method" |
343 | 963 |
|
964 |
i43 := something. |
|
965 |
||
966 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
967 |
! |
|
968 |
||
969 |
i44 |
|
616 | 970 |
"prototype method" |
343 | 971 |
|
972 |
^ i44 |
|
973 |
||
974 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
975 |
! |
|
976 |
||
977 |
i44:something |
|
616 | 978 |
"prototype method" |
343 | 979 |
|
980 |
i44 := something. |
|
981 |
||
982 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
983 |
! |
|
984 |
||
985 |
i45 |
|
616 | 986 |
"prototype method" |
343 | 987 |
|
988 |
^ i45 |
|
989 |
||
990 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
991 |
! |
|
992 |
||
993 |
i45:something |
|
616 | 994 |
"prototype method" |
343 | 995 |
|
996 |
i45 := something. |
|
997 |
||
998 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
999 |
! |
|
1000 |
||
1001 |
i46 |
|
616 | 1002 |
"prototype method" |
343 | 1003 |
|
1004 |
^ i46 |
|
1005 |
||
1006 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
1007 |
! |
|
1008 |
||
1009 |
i46:something |
|
616 | 1010 |
"prototype method" |
343 | 1011 |
|
1012 |
i46 := something. |
|
1013 |
||
1014 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
1015 |
! |
|
1016 |
||
1017 |
i47 |
|
616 | 1018 |
"prototype method" |
343 | 1019 |
|
1020 |
^ i47 |
|
1021 |
||
1022 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
1023 |
! |
|
1024 |
||
1025 |
i47:something |
|
616 | 1026 |
"prototype method" |
343 | 1027 |
|
1028 |
i47 := something. |
|
1029 |
||
1030 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
1031 |
! |
|
1032 |
||
1033 |
i48 |
|
616 | 1034 |
"prototype method" |
343 | 1035 |
|
1036 |
^ i48 |
|
1037 |
||
1038 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
1039 |
! |
|
1040 |
||
1041 |
i48:something |
|
616 | 1042 |
"prototype method" |
343 | 1043 |
|
1044 |
i48 := something. |
|
1045 |
||
1046 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
1047 |
! |
|
1048 |
||
1049 |
i49 |
|
616 | 1050 |
"prototype method" |
343 | 1051 |
|
1052 |
^ i49 |
|
1053 |
||
1054 |
"Created: 21.9.1996 / 16:06:23 / cg" |
|
1055 |
! |
|
1056 |
||
1057 |
i49:something |
|
616 | 1058 |
"prototype method" |
343 | 1059 |
|
1060 |
i49 := something. |
|
1061 |
||
1062 |
"Created: 21.9.1996 / 16:06:24 / cg" |
|
1063 |
! |
|
1064 |
||
282 | 1065 |
i4:something |
616 | 1066 |
"prototype method to set the 4th instance variable" |
282 | 1067 |
|
1068 |
i4 := something. |
|
1069 |
||
1070 |
"Created: 13.5.1996 / 21:19:25 / cg" |
|
1071 |
! |
|
1072 |
||
1073 |
i5 |
|
616 | 1074 |
"prototype method to return the 5th instance variable" |
282 | 1075 |
|
1076 |
^ i5 |
|
1077 |
||
1078 |
"Created: 13.5.1996 / 21:19:26 / cg" |
|
1079 |
! |
|
1080 |
||
343 | 1081 |
i50 |
616 | 1082 |
"prototype method" |
343 | 1083 |
|
1084 |
^ i50 |
|
1085 |
||
1086 |
"Created: 21.9.1996 / 16:06:24 / cg" |
|
1087 |
! |
|
1088 |
||
1089 |
i50:something |
|
616 | 1090 |
"prototype method" |
343 | 1091 |
|
1092 |
i50 := something. |
|
1093 |
||
1094 |
"Created: 21.9.1996 / 16:06:24 / cg" |
|
1095 |
! |
|
1096 |
||
282 | 1097 |
i5:something |
616 | 1098 |
"prototype method to set the 5th instance variable" |
282 | 1099 |
|
1100 |
i5 := something. |
|
1101 |
||
1102 |
"Created: 13.5.1996 / 21:19:26 / cg" |
|
1103 |
! |
|
1104 |
||
1105 |
i6 |
|
616 | 1106 |
"prototype method to return the 6th instance variable" |
282 | 1107 |
|
1108 |
^ i6 |
|
1109 |
||
1110 |
"Created: 13.5.1996 / 21:19:26 / cg" |
|
1111 |
! |
|
1112 |
||
1113 |
i6:something |
|
616 | 1114 |
"prototype method to set the 6th instance variable" |
282 | 1115 |
|
1116 |
i6 := something. |
|
1117 |
||
1118 |
"Created: 13.5.1996 / 21:19:26 / cg" |
|
1119 |
! |
|
1120 |
||
1121 |
i7 |
|
616 | 1122 |
"prototype method to return the 7th instance variable" |
282 | 1123 |
|
1124 |
^ i7 |
|
1125 |
||
1126 |
"Created: 13.5.1996 / 21:19:26 / cg" |
|
1127 |
! |
|
1128 |
||
1129 |
i7:something |
|
616 | 1130 |
"prototype method to set the 7th instance variable" |
282 | 1131 |
|
1132 |
i7 := something. |
|
1133 |
||
1134 |
"Created: 13.5.1996 / 21:19:26 / cg" |
|
1135 |
! |
|
1136 |
||
1137 |
i8 |
|
616 | 1138 |
"prototype method to return the 8th instance variable" |
282 | 1139 |
|
1140 |
^ i8 |
|
1141 |
||
1142 |
"Created: 13.5.1996 / 21:19:26 / cg" |
|
1143 |
! |
|
1144 |
||
1145 |
i8:something |
|
616 | 1146 |
"prototype method to set the 8th instance variable" |
282 | 1147 |
|
1148 |
i8 := something. |
|
1149 |
||
1150 |
"Created: 13.5.1996 / 21:19:26 / cg" |
|
1151 |
! |
|
1152 |
||
1153 |
i9 |
|
616 | 1154 |
"prototype method to return the 9th instance variable" |
282 | 1155 |
|
1156 |
^ i9 |
|
1157 |
||
1158 |
"Created: 13.5.1996 / 21:19:26 / cg" |
|
1159 |
! |
|
1160 |
||
1161 |
i9:something |
|
616 | 1162 |
"prototype method to set the 9th instance variable" |
282 | 1163 |
|
1164 |
i9 := something. |
|
1165 |
||
1166 |
"Created: 13.5.1996 / 21:19:27 / cg" |
|
1167 |
! |
|
1168 |
||
1169 |
instSize |
|
1170 |
"return instSize - required class protocol" |
|
1171 |
||
1172 |
^ instSize |
|
1173 |
||
1174 |
"Created: 13.5.1996 / 21:19:24 / cg" |
|
1175 |
! |
|
1176 |
||
1177 |
instSize:something |
|
1178 |
"set instSize - required class protocol" |
|
1179 |
||
1180 |
instSize := something. |
|
1181 |
||
1182 |
"Created: 13.5.1996 / 21:19:25 / cg" |
|
1183 |
! |
|
1184 |
||
429 | 1185 |
methodDictionary |
1186 |
"return the methodDictionary - required class protocol" |
|
282 | 1187 |
|
429 | 1188 |
^ methodDictionary |
282 | 1189 |
! |
1190 |
||
1191 |
superclass |
|
1192 |
"return superclass - required class protocol" |
|
1193 |
||
1194 |
^ superclass |
|
1195 |
||
1196 |
"Created: 13.5.1996 / 21:19:23 / cg" |
|
1197 |
! |
|
1198 |
||
1199 |
superclass:something |
|
1200 |
"set superclass - required class protocol" |
|
1201 |
||
1202 |
superclass := something. |
|
1203 |
||
1204 |
"Created: 13.5.1996 / 21:19:23 / cg" |
|
1205 |
! ! |
|
1206 |
||
1207 |
!Structure methodsFor:'stubs'! |
|
1208 |
||
1209 |
doesNotUnderstand:aMessage |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
1210 |
"catch unimplemented messages - pass some to the superclass. |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
1211 |
Notice that although this method calls super messages, |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
1212 |
actual instances will have no valid superClass." |
282 | 1213 |
|
616 | 1214 |
|sel args names sz s idx| |
282 | 1215 |
|
1216 |
"/ instance protocol |
|
1217 |
||
1218 |
sel := aMessage selector. |
|
1219 |
args := aMessage arguments. |
|
1220 |
||
1221 |
sel == #displayString ifTrue:[ |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
1222 |
s := WriteStream on:''. |
282 | 1223 |
s nextPutAll:'Structure('. |
1130 | 1224 |
names := self allInstVarNames. |
1225 |
names notNil ifTrue:[ |
|
1226 |
names keysAndValuesDo:[:idx :nm | |
|
1227 |
s nextPutAll:nm; nextPutAll:'->'. |
|
1228 |
s nextPutAll:(self at:idx) displayString. |
|
1229 |
s space |
|
1230 |
]. |
|
1231 |
]. |
|
1232 |
s nextPutAll:')'. |
|
1233 |
^ s contents |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
1234 |
]. |
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
1235 |
|
282 | 1236 |
sel == #basicInspect ifTrue:[ |
1237 |
^ InspectorView openOn:self |
|
1238 |
]. |
|
1239 |
||
1424 | 1240 |
sel == #inspectorClass ifTrue:[ |
1241 |
^ InspectorView |
|
1242 |
]. |
|
282 | 1243 |
sel == #inspect ifTrue:[ |
1244 |
^ InspectorView openOn:self |
|
1245 |
]. |
|
1246 |
||
1247 |
sel == #instVarAt: ifTrue:[ |
|
1248 |
|nr| |
|
1249 |
||
1250 |
nr := args at:1. |
|
1251 |
nr == 1 ifTrue:[^ i1]. |
|
1252 |
nr == 2 ifTrue:[^ i2]. |
|
1253 |
nr == 3 ifTrue:[^ i3]. |
|
1254 |
nr == 4 ifTrue:[^ i4]. |
|
1255 |
nr == 5 ifTrue:[^ i5]. |
|
1256 |
nr == 6 ifTrue:[^ i6]. |
|
1481 | 1257 |
nr == 7 ifTrue:[^ i7]. |
1258 |
nr == 8 ifTrue:[^ i8]. |
|
1259 |
nr == 9 ifTrue:[^ i9]. |
|
1260 |
nr == 10 ifTrue:[^ i10]. |
|
1261 |
nr == 11 ifTrue:[^ i11]. |
|
1262 |
nr == 12 ifTrue:[^ i12]. |
|
1263 |
nr == 13 ifTrue:[^ i13]. |
|
1264 |
nr == 14 ifTrue:[^ i14]. |
|
282 | 1265 |
^ nil |
1266 |
]. |
|
1267 |
||
1129 | 1268 |
(sel == #'perform:') ifTrue:[ |
1269 |
^ super perform:(args at:1) |
|
1270 |
]. |
|
1559 | 1271 |
(sel == #'perform:with:') ifTrue:[ |
1272 |
^ super perform:(args at:1) with:(args at:2) |
|
1273 |
]. |
|
1129 | 1274 |
|
1275 |
(sel == #'=') ifTrue:[ |
|
1130 | 1276 |
(args at:1) class == (args at:1) ifFalse:[^ false]. "/ must be another struct |
1277 |
names := self allInstVarNames. |
|
1278 |
names notNil ifTrue:[ |
|
1377
24f668298ef1
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
1243
diff
changeset
|
1279 |
Error handle:[:ex | |
1130 | 1280 |
^ false |
1281 |
] do:[ |
|
1282 |
names do:[:slotName | |
|
1283 |
((args at:1) perform:slotName asSymbol) = (self perform:slotName asSymbol) |
|
1284 |
ifFalse:[slotName halt. ^ false] |
|
1285 |
] |
|
1286 |
]. |
|
1287 |
]. |
|
1288 |
^ true. |
|
1129 | 1289 |
]. |
1290 |
(sel == #'~=') ifTrue:[ |
|
1291 |
^ super ~= (args at:1) |
|
1292 |
]. |
|
1293 |
||
282 | 1294 |
(sel == #size |
1295 |
or:[sel == #basicSize]) ifTrue:[ |
|
1296 |
^ super basicSize |
|
1297 |
]. |
|
1298 |
||
1299 |
(sel == #at: |
|
1300 |
or:[sel == #basicAt:]) ifTrue:[ |
|
1301 |
^ super basicAt:(args at:1) |
|
1302 |
]. |
|
1303 |
||
1304 |
(sel == #at:put: |
|
1305 |
or:[sel == #basicAt:put:]) ifTrue:[ |
|
1306 |
^ super basicAt:(args at:1) put:(args at:2) |
|
1307 |
]. |
|
1308 |
||
1309 |
sel == #== ifTrue:[ |
|
1310 |
^ self == (args at:1) |
|
1311 |
]. |
|
1312 |
||
945 | 1313 |
sel == #clone ifTrue:[ |
1314 |
^ super clone |
|
1315 |
]. |
|
1316 |
sel == #shallowCopy ifTrue:[ |
|
1317 |
^ super shallowCopy |
|
1318 |
]. |
|
1319 |
||
1320 |
||
282 | 1321 |
"/ class protocol |
1322 |
||
1323 |
(sel := aMessage selector) == #name ifTrue:[ |
|
1324 |
^ 'Structure' |
|
1325 |
]. |
|
1326 |
||
1327 |
sel == #isVariable ifTrue:[ |
|
1328 |
^ false |
|
1329 |
]. |
|
1330 |
||
1331 |
sel == #isClass ifTrue:[ |
|
1332 |
^ false |
|
1333 |
]. |
|
1334 |
||
1335 |
sel == #isMeta ifTrue:[ |
|
1336 |
^ false |
|
1337 |
]. |
|
1338 |
||
1339 |
sel == #isBehavior ifTrue:[ |
|
1340 |
^ false |
|
1341 |
]. |
|
1342 |
||
1243 | 1343 |
sel == #isKindOf: ifTrue:[ |
1344 |
^ false |
|
1345 |
]. |
|
1346 |
||
2006 | 1347 |
sel == #isString ifTrue:[ |
1348 |
^ false |
|
1349 |
]. |
|
1350 |
||
282 | 1351 |
sel == #respondsTo: ifTrue:[ |
1352 |
^ false |
|
1353 |
]. |
|
1354 |
||
616 | 1355 |
sel == #whichClassIncludesSelector: ifTrue:[ |
1356 |
^ nil |
|
1357 |
]. |
|
1358 |
||
282 | 1359 |
sel == #evaluatorClass ifTrue:[ |
1360 |
^ Compiler |
|
1361 |
]. |
|
1362 |
||
1363 |
sel == #classNameWithArticle ifTrue:[ |
|
1364 |
^ self displayString |
|
1365 |
]. |
|
1366 |
||
1367 |
sel == #allSubclasses ifTrue:[ |
|
1368 |
^ #() |
|
1369 |
]. |
|
1370 |
||
1371 |
sel == #allClassVarNames ifTrue:[ |
|
1372 |
^ #() |
|
1373 |
]. |
|
1559 | 1374 |
sel == #methodDictionary ifTrue:[ |
1375 |
^methodDictionary |
|
1376 |
]. |
|
282 | 1377 |
|
1378 |
sel == #allInstVarNames ifTrue:[ |
|
616 | 1379 |
methodDictionary isNil ifTrue:[ |
1486 | 1380 |
'Structure [info]: oops - nil methodDict' infoPrintCR. |
616 | 1381 |
^ #() |
1382 |
]. |
|
1383 |
||
282 | 1384 |
sz := super basicSize. |
1385 |
names := Array new:sz. |
|
1386 |
||
616 | 1387 |
methodDictionary keysAndValuesDo:[:sel :mthd| |
1388 |
|index mysel| |
|
1389 |
||
282 | 1390 |
(sel endsWith:$:) ifFalse:[ |
1391 |
(sel ~~ #class) ifTrue:[ |
|
1392 |
"/ |
|
1393 |
"/ which method is it ? |
|
1394 |
"/ |
|
616 | 1395 |
idx := 1. |
1396 |
[idx <= sz] whileTrue:[ |
|
1397 |
mysel := ('i' , idx printString) asSymbol. |
|
282 | 1398 |
mthd == (Structure compiledMethodAt:mysel) ifTrue:[ |
616 | 1399 |
names at:idx put:sel. |
1400 |
idx := sz. "/ break |
|
1401 |
]. |
|
1402 |
idx := idx + 1. |
|
282 | 1403 |
]. |
1404 |
] |
|
1405 |
] |
|
1406 |
]. |
|
1407 |
||
1408 |
^ names |
|
1409 |
]. |
|
1410 |
||
943
5a9699ed4b9b
give the dummy class another name, to avoid confusion with
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
1411 |
(sel == #instSize) ifTrue:[ |
5a9699ed4b9b
give the dummy class another name, to avoid confusion with
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
1412 |
^ instSize |
5a9699ed4b9b
give the dummy class another name, to avoid confusion with
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
1413 |
]. |
5a9699ed4b9b
give the dummy class another name, to avoid confusion with
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
1414 |
|
1486 | 1415 |
'Structure [warning]: return nil for: ' infoPrint. |
1416 |
aMessage infoPrint. |
|
1417 |
' args ' infoPrint. args infoPrintCR. |
|
282 | 1418 |
|
294
6f937c0ba907
fixes for new MethodDictionary
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
1419 |
^ nil. |
282 | 1420 |
|
1421 |
"Created: 13.5.1996 / 20:22:22 / cg" |
|
1422 |
"Modified: 13.5.1996 / 21:12:54 / cg" |
|
1423 |
! ! |
|
1424 |
||
616 | 1425 |
!Structure class methodsFor:'documentation'! |
282 | 1426 |
|
1427 |
version |
|
2006 | 1428 |
^ '$Header: /cvs/stx/stx/libcomp/Structure.st,v 1.21 2007-03-13 15:37:58 cg Exp $' |
282 | 1429 |
! ! |
1377
24f668298ef1
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
1243
diff
changeset
|
1430 |
|
282 | 1431 |
Structure initialize! |