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