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