1089
|
1 |
"{ Package: 'stx:libbasic3' }"
|
|
2 |
|
|
3 |
Object subclass:#MethodFinder
|
1106
|
4 |
instanceVariableNames:'data answers selector argMap thisData mapStage mapList
|
|
5 |
expressions cachedClass cachedArgNum cachedSelectorLists'
|
1491
|
6 |
classVariableNames:'AddAndRemove Approved Blocks BlocksOptional Dangerous'
|
1106
|
7 |
poolDictionaries:''
|
1114
|
8 |
category:'Interface-MethodFinder'
|
1089
|
9 |
!
|
|
10 |
|
1100
|
11 |
!MethodFinder class methodsFor:'documentation'!
|
|
12 |
|
|
13 |
documentation
|
|
14 |
"
|
|
15 |
[author:]
|
|
16 |
ported from Squeak and GUI enhanced by James Hayes james@exept.de
|
|
17 |
"
|
|
18 |
! !
|
1089
|
19 |
|
|
20 |
!MethodFinder class methodsFor:'accessing'!
|
|
21 |
|
|
22 |
abortAllSignal
|
|
23 |
"return the value of the static variable 'AbortAllSignal' (automatically generated)"
|
|
24 |
|
|
25 |
^ AbortAllSignal
|
|
26 |
!
|
|
27 |
|
|
28 |
abortAllSignal:something
|
|
29 |
"set the value of the static variable 'AbortAllSignal' (automatically generated)"
|
|
30 |
|
|
31 |
AbortAllSignal := something.
|
|
32 |
!
|
|
33 |
|
|
34 |
addAndRemove
|
|
35 |
"return the value of the static variable 'AddAndRemove' (automatically generated)"
|
|
36 |
|
|
37 |
^ AddAndRemove
|
|
38 |
!
|
|
39 |
|
|
40 |
addAndRemove:something
|
|
41 |
"set the value of the static variable 'AddAndRemove' (automatically generated)"
|
|
42 |
|
|
43 |
AddAndRemove := something.
|
|
44 |
!
|
|
45 |
|
|
46 |
approved
|
|
47 |
"return the value of the static variable 'Approved' (automatically generated)"
|
|
48 |
|
|
49 |
^ Approved
|
|
50 |
!
|
|
51 |
|
|
52 |
approved:something
|
|
53 |
"set the value of the static variable 'Approved' (automatically generated)"
|
|
54 |
|
|
55 |
Approved := something.
|
|
56 |
!
|
|
57 |
|
|
58 |
blocks
|
|
59 |
"return the value of the static variable 'Blocks' (automatically generated)"
|
|
60 |
|
|
61 |
^ Blocks
|
|
62 |
!
|
|
63 |
|
|
64 |
blocks:something
|
|
65 |
"set the value of the static variable 'Blocks' (automatically generated)"
|
|
66 |
|
|
67 |
Blocks := something.
|
|
68 |
!
|
|
69 |
|
|
70 |
dangerous
|
|
71 |
"return the value of the static variable 'Dangerous' (automatically generated)"
|
|
72 |
|
|
73 |
^ Dangerous
|
|
74 |
!
|
|
75 |
|
|
76 |
dangerous:something
|
|
77 |
"set the value of the static variable 'Dangerous' (automatically generated)"
|
|
78 |
|
|
79 |
Dangerous := something.
|
|
80 |
! !
|
|
81 |
|
|
82 |
!MethodFinder class methodsFor:'as yet unclassified'!
|
|
83 |
|
|
84 |
methodFor: dataAndAnswers
|
1104
|
85 |
"Return a Squeak expression that computes these answers. (This method is called by the comment in the bottom pane of a MethodFinder. Do not delete this method.)"
|
1089
|
86 |
|
1104
|
87 |
| resultOC selFinder resultString |
|
1089
|
88 |
|
1104
|
89 |
resultOC _ (self new) load: dataAndAnswers; findMessage.
|
|
90 |
resultString _ String streamContents: [:strm |
|
|
91 |
resultOC do: [:exp | strm nextPut: $(; nextPutAll: exp; nextPut: $); space]].
|
|
92 |
Smalltalk isMorphic ifTrue: [
|
|
93 |
selFinder _ (Display bestGuessOfCurrentWorld
|
|
94 |
submorphThat: [:mm | mm class == SystemWindow and:
|
|
95 |
[mm model isKindOf: SelectorBrowser]]
|
|
96 |
ifNone: [^ resultString]) model.
|
|
97 |
selFinder searchResult: resultOC].
|
1089
|
98 |
|
1104
|
99 |
^ resultString
|
1089
|
100 |
! !
|
|
101 |
|
|
102 |
!MethodFinder methodsFor:'access'!
|
|
103 |
|
|
104 |
answers
|
|
105 |
|
1104
|
106 |
^ answers
|
1089
|
107 |
!
|
|
108 |
|
|
109 |
data
|
|
110 |
|
1104
|
111 |
^ data
|
1089
|
112 |
!
|
|
113 |
|
|
114 |
expressions
|
1104
|
115 |
^ expressions
|
1089
|
116 |
!
|
|
117 |
|
|
118 |
selectors
|
1104
|
119 |
"Note the inst var does not have an S on the end"
|
1089
|
120 |
|
1104
|
121 |
^ selector
|
1089
|
122 |
! !
|
|
123 |
|
|
124 |
!MethodFinder methodsFor:'arg maps'!
|
|
125 |
|
|
126 |
argMap
|
1104
|
127 |
^ argMap
|
1089
|
128 |
!
|
|
129 |
|
|
130 |
makeAllMaps
|
1104
|
131 |
"Make a giant list of all permutations of the args. To find the function, we will try these permutations of the input data. receiver, args."
|
1089
|
132 |
|
1104
|
133 |
| ii |
|
|
134 |
mapList _ Array new: argMap size factorial.
|
|
135 |
ii _ 1.
|
|
136 |
argMap permutationsDo: [:perm |
|
|
137 |
mapList at: ii put: perm copy.
|
|
138 |
ii _ ii + 1].
|
|
139 |
mapStage _ 1. "about to be bumped"
|
1089
|
140 |
!
|
|
141 |
|
|
142 |
mapData
|
1104
|
143 |
"Force the data through the map (permutation) to create the data to test."
|
1089
|
144 |
|
1104
|
145 |
thisData _ data collect: [:realData |
|
|
146 |
argMap collect: [:ind | realData at: ind]].
|
|
147 |
|
1089
|
148 |
!
|
|
149 |
|
|
150 |
permuteArgs
|
1104
|
151 |
"Run through ALL the permutations. First one was as presented."
|
1089
|
152 |
|
1104
|
153 |
data first size <= 1 ifTrue: [^ false]. "no other way"
|
1928
|
154 |
mapList isNil ifTrue: [self makeAllMaps].
|
1104
|
155 |
mapStage _ mapStage + 1.
|
|
156 |
mapStage > mapList size ifTrue: [^ false].
|
|
157 |
argMap _ mapList at: mapStage.
|
|
158 |
self mapData.
|
|
159 |
^ true
|
1089
|
160 |
!
|
|
161 |
|
|
162 |
thisData
|
1104
|
163 |
^ thisData
|
1089
|
164 |
! !
|
|
165 |
|
|
166 |
!MethodFinder methodsFor:'find a constant'!
|
|
167 |
|
|
168 |
allNumbers
|
1104
|
169 |
"Return true if all answers and all data are numbers."
|
1089
|
170 |
|
1104
|
171 |
answers do: [:aa | aa isNumber ifFalse: [^ false]].
|
|
172 |
thisData do: [:vec |
|
|
173 |
vec do: [:nn | nn isNumber ifFalse: [^ false]]].
|
|
174 |
^ true
|
1089
|
175 |
!
|
|
176 |
|
|
177 |
const
|
1104
|
178 |
| const |
|
|
179 |
"See if (^ constant) is the answer"
|
1089
|
180 |
|
1104
|
181 |
"quick test"
|
|
182 |
((const _ answers at: 1) closeTo: (answers at: 2)) ifFalse: [^ false].
|
|
183 |
3 to: answers size do: [:ii | (const closeTo: (answers at: ii)) ifFalse: [^ false]].
|
|
184 |
expressions add: '^ ', const printString.
|
|
185 |
selector add: #yourself.
|
|
186 |
^ true
|
1089
|
187 |
!
|
|
188 |
|
|
189 |
constDiv
|
|
190 |
| const subTest got |
|
|
191 |
"See if (data1 // C) is the answer"
|
|
192 |
self halt.
|
|
193 |
^ false.
|
|
194 |
const _ ((thisData at: 1) at: 1) // (answers at: 1). "May not be right!!"
|
|
195 |
got _ (subTest _ MethodFinder new copy: self addArg: const)
|
|
196 |
searchForOne isEmpty not.
|
|
197 |
got ifFalse: [^ false].
|
|
198 |
|
|
199 |
"replace data2 with const in expressions"
|
|
200 |
subTest expressions do: [:exp |
|
|
201 |
expressions add: (exp copyReplaceAll: 'data2' with: const printString)].
|
|
202 |
selector addAll: subTest selectors.
|
|
203 |
^ true
|
|
204 |
!
|
|
205 |
|
|
206 |
constLessThan
|
1104
|
207 |
| const subTest got minConst maxConst tt |
|
|
208 |
"See if (data1 <= C) or (data1 >= C) is the answer"
|
1089
|
209 |
|
1104
|
210 |
"quick test"
|
|
211 |
((answers at: 1) class superclass == Boolean) ifFalse: [^ false].
|
|
212 |
2 to: answers size do: [:ii |
|
|
213 |
((answers at: ii) class superclass == Boolean) ifFalse: [^ false]].
|
1089
|
214 |
|
1104
|
215 |
minConst _ Float infinity. maxConst _ minConst negated.
|
|
216 |
answers withIndexDo: [:aa :ii |
|
|
217 |
aa ifTrue: [tt _ (thisData at: ii) at: 1.
|
|
218 |
minConst _ minConst min: tt.
|
|
219 |
maxConst _ maxConst max: tt]].
|
|
220 |
const _ (thisData at: 1) at: 1.
|
|
221 |
got _ (subTest _ MethodFinder new copy: self addArg: minConst)
|
|
222 |
searchForOne isEmpty not.
|
|
223 |
got ifFalse: ["try other extreme for <= >= "
|
|
224 |
got _ (subTest _ MethodFinder new copy: self addArg: maxConst)
|
|
225 |
searchForOne isEmpty not].
|
|
226 |
got ifFalse: [^ false].
|
1089
|
227 |
|
1104
|
228 |
"replace data2 with const in expressions"
|
|
229 |
subTest expressions do: [:exp |
|
|
230 |
expressions add: (exp copyReplaceAll: 'data2' with: const printString)].
|
|
231 |
selector addAll: subTest selectors.
|
|
232 |
^ true
|
1089
|
233 |
!
|
|
234 |
|
|
235 |
constLinear
|
1104
|
236 |
| const subTest got denom num slope offset |
|
|
237 |
"See if (data1 * C1) + C2 is the answer. In the form #(C2 C1) polynomialEval: data1 "
|
1089
|
238 |
|
1104
|
239 |
denom _ ((thisData at: 2) at: 1) - ((thisData at: 1) at: 1).
|
|
240 |
denom = 0 ifTrue: [^ false]. "will divide by it"
|
|
241 |
num _ (answers at: 2) - (answers at: 1).
|
1089
|
242 |
|
|
243 |
slope := (num asFloat / denom) reduce.
|
|
244 |
offset := ((answers at: 2) - (((thisData at: 2) at: 1) * slope)) reduce.
|
|
245 |
|
1104
|
246 |
const _ Array with: offset with: slope.
|
|
247 |
got _ (subTest _ MethodFinder new copy: self addArg: const)
|
|
248 |
searchForOne isEmpty not.
|
|
249 |
got ifFalse: [^ false].
|
1089
|
250 |
|
1104
|
251 |
"replace data2 with const in expressions"
|
|
252 |
subTest expressions do: [:exp |
|
|
253 |
expressions add: (exp copyReplaceAll: 'data2' with: const printString)].
|
|
254 |
selector addAll: subTest selectors.
|
|
255 |
^ true
|
1089
|
256 |
!
|
|
257 |
|
|
258 |
constMod
|
1104
|
259 |
| subTest low |
|
|
260 |
"See if mod, (data1 \\ C) is the answer"
|
1089
|
261 |
|
1104
|
262 |
low _ answers max.
|
|
263 |
low+1 to: low+20 do: [:const |
|
|
264 |
subTest _ MethodFinder new copy: self addArg: const.
|
|
265 |
(subTest testPerfect: #\\) ifTrue: [
|
|
266 |
expressions add: 'data1 \\ ', const printString.
|
|
267 |
selector add: #\\.
|
|
268 |
^ true]].
|
|
269 |
^ false
|
1089
|
270 |
!
|
|
271 |
|
|
272 |
constMult
|
1104
|
273 |
| const subTest got |
|
|
274 |
"See if (data1 * C) is the answer"
|
1089
|
275 |
|
1104
|
276 |
((thisData at: 1) at: 1) = 0 ifTrue: [^ false].
|
|
277 |
const _ ((answers at: 1) asFloat / ((thisData at: 1) at: 1)) reduce.
|
|
278 |
got _ (subTest _ MethodFinder new copy: self addArg: const)
|
|
279 |
searchForOne isEmpty not.
|
|
280 |
got ifFalse: [^ false].
|
1089
|
281 |
|
1104
|
282 |
"replace data2 with const in expressions"
|
|
283 |
subTest expressions do: [:exp |
|
|
284 |
expressions add: (exp copyReplaceAll: 'data2' with: const printString)].
|
|
285 |
selector addAll: subTest selectors.
|
|
286 |
^ true
|
1089
|
287 |
!
|
|
288 |
|
|
289 |
constPlus
|
1104
|
290 |
| const subTest got |
|
|
291 |
"See if (data1 + C) is the answer"
|
1089
|
292 |
|
1104
|
293 |
const _ (answers at: 1) - ((thisData at: 1) at: 1).
|
|
294 |
got _ (subTest _ MethodFinder new copy: self addArg: const)
|
|
295 |
searchForOne isEmpty not.
|
|
296 |
got ifFalse: [^ false].
|
1089
|
297 |
|
1104
|
298 |
"replace data2 with const in expressions"
|
|
299 |
subTest expressions do: [:exp |
|
|
300 |
expressions add: (exp copyReplaceAll: 'data2' with: const printString)].
|
|
301 |
selector addAll: subTest selectors.
|
|
302 |
^ true
|
1089
|
303 |
! !
|
|
304 |
|
|
305 |
!MethodFinder methodsFor:'initialize'!
|
|
306 |
|
|
307 |
cleanInputs: dataAndAnswerString
|
1104
|
308 |
"Find an remove common mistakes. Complain when ill formed."
|
1089
|
309 |
|
|
310 |
| fixed ddd rs places |
|
|
311 |
ddd _ dataAndAnswerString.
|
|
312 |
fixed _ false.
|
|
313 |
|
|
314 |
rs _ ReadStream on: ddd, ' '.
|
|
315 |
places _ OrderedCollection new.
|
|
316 |
[rs upToAll: '#true'. rs atEnd] whileFalse: [places addFirst: rs position-4].
|
|
317 |
places do: [:pos | ddd _ ddd copyReplaceFrom: pos to: pos with: ''.
|
1104
|
318 |
fixed _ true]. "remove #"
|
1089
|
319 |
|
|
320 |
rs _ ReadStream on: ddd.
|
|
321 |
places _ OrderedCollection new.
|
|
322 |
[rs upToAll: '#false'. rs atEnd] whileFalse: [places addFirst: rs position-5].
|
|
323 |
places do: [:pos | ddd _ ddd copyReplaceFrom: pos to: pos with: ''.
|
1104
|
324 |
fixed _ true]. "remove #"
|
1089
|
325 |
|
|
326 |
fixed ifTrue: [self inform: '#(true false) are Symbols, not Booleans.
|
|
327 |
Next time use { true. false }.'].
|
|
328 |
|
|
329 |
fixed _ false.
|
|
330 |
rs _ ReadStream on: ddd.
|
|
331 |
places _ OrderedCollection new.
|
|
332 |
[rs upToAll: '#nil'. rs atEnd] whileFalse: [places addFirst: rs position-3].
|
|
333 |
places do: [:pos | ddd _ ddd copyReplaceFrom: pos to: pos with: ''.
|
1104
|
334 |
fixed _ true]. "remove #"
|
1089
|
335 |
|
|
336 |
fixed ifTrue: [self inform: '#nil is a Symbol, not the authentic UndefinedObject.
|
|
337 |
Next time use nil instead of #nil'].
|
|
338 |
|
|
339 |
^ ddd
|
|
340 |
!
|
|
341 |
|
|
342 |
initialize
|
|
343 |
"The methods we are allowed to use. (MethodFinder new initialize) "
|
|
344 |
Approved _ Set new.
|
|
345 |
AddAndRemove _ Set new.
|
1491
|
346 |
Blocks _ Set new.
|
|
347 |
BlocksOptional := Set new.
|
1089
|
348 |
"These modify an argument: longPrintOn: printOn: storeOn: sentTo: storeOn:base: printOn:base: absPrintExactlyOn:base: absPrintOn:base: absPrintOn:base:digitCount: writeOn: writeScanOn: possibleVariablesFor:continuedFrom:"
|
|
349 |
|
|
350 |
"Object"
|
1108
|
351 |
#(
|
|
352 |
"in class, instance creation"
|
|
353 |
categoryForUniclasses chooseUniqueClassName initialInstance isSystemDefined newFrom: officialClass readCarefullyFrom:
|
|
354 |
"accessing"
|
|
355 |
at: basicAt: basicSize bindWithTemp: in: size yourself
|
|
356 |
"testing"
|
1109
|
357 |
basicType ifNil: #'ifNil:ifNotNil:' ifNotNil: #'ifNotNil:ifNil:'
|
|
358 |
isColor isFloat isFraction isInMemory isInteger isMorph isNil isNumber
|
|
359 |
isPoint isPseudoContext isText isTransparent isWebBrowser
|
|
360 |
knownName notNil pointsTo: wantsSteps
|
1108
|
361 |
"comparing"
|
1109
|
362 |
= == closeTo: hash hashMappedBy: identityHash identityHashMappedBy: identityHashPrintString
|
|
363 |
~= ~~
|
1108
|
364 |
"copying"
|
|
365 |
clone copy shallowCopy
|
|
366 |
"dependents access"
|
|
367 |
canDiscardEdits dependents hasUnacceptedEdits
|
|
368 |
"updating"
|
|
369 |
changed changed: okToChange update: windowIsClosing
|
|
370 |
"printing"
|
|
371 |
fullPrintString isLiteral longPrintString printString storeString stringForReadout stringRepresentation
|
|
372 |
"class membership"
|
1109
|
373 |
class isKindOf: #'isKindOf:orOf:' isMemberOf: respondsTo: respondsToArithmetic
|
1108
|
374 |
"error handling"
|
|
375 |
"user interface"
|
|
376 |
defaultBackgroundColor defaultLabelForInspector fullScreenSize initialExtent modelWakeUp mouseUpBalk: newTileMorphRepresentative windowActiveOnFirstClick windowReqNewLabel:
|
|
377 |
"system primitives"
|
|
378 |
instVarAt: instVarNamed:
|
|
379 |
"private"
|
|
380 |
"associating" ->
|
|
381 |
"converting"
|
|
382 |
as: asOrderedCollection asString
|
|
383 |
"casing"
|
|
384 |
caseOf: #'caseOf:otherwise:'
|
|
385 |
"binding"
|
|
386 |
bindingOf:
|
|
387 |
"macpal"
|
|
388 |
contentsChanged #'ifKindOf:thenDo:' instanceVariableValues
|
|
389 |
"flagging"
|
|
390 |
flag:
|
|
391 |
"translation support"
|
|
392 |
"objects from disk"
|
|
393 |
"finalization"
|
1109
|
394 |
"ST/X converting"
|
|
395 |
literalArrayEncoding
|
1108
|
396 |
) do: [:sel | Approved add: sel].
|
|
397 |
|
|
398 |
#(
|
|
399 |
#'at:add:' #'at:modify:' #'at:put:' #'basicAt:put:' "NOT instVar:at:"
|
|
400 |
"message handling"
|
|
401 |
perform:
|
|
402 |
#'perform:with:' #'perform:with:with:' #'perform:with:with:with:' #'perform:withArguments:'
|
|
403 |
#'perform:withArguments:inSuperclass:'
|
|
404 |
#'perform:orSendTo:'
|
|
405 |
) do: [:sel | AddAndRemove add: sel].
|
1089
|
406 |
|
|
407 |
"Boolean, True, False, UndefinedObject"
|
1108
|
408 |
#(
|
|
409 |
"logical operations"
|
|
410 |
& eqv: not xor: |
|
|
411 |
"controlling"
|
1961
|
412 |
and: ifFalse: #'ifFalse:ifTrue:' ifTrue: #'ifTrue:ifFalse:' or: ifNil: ifNotNil:
|
1108
|
413 |
"copying"
|
|
414 |
"testing"
|
1109
|
415 |
isEmptyOrNil isNilOrEmptyCollection
|
1108
|
416 |
) do: [:sel | Approved add: sel].
|
1089
|
417 |
|
|
418 |
"Behavior"
|
|
419 |
#("initialize-release"
|
1108
|
420 |
"accessing"
|
|
421 |
compilerClass decompilerClass evaluatorClass format methodDict parserClass sourceCodeTemplate subclassDefinerClass
|
|
422 |
"testing"
|
|
423 |
instSize instSpec isBits isBytes isFixed isPointers isVariable isWeak isWords
|
|
424 |
"copying"
|
|
425 |
"printing"
|
|
426 |
defaultNameStemForInstances printHierarchy
|
|
427 |
"creating class hierarchy"
|
|
428 |
"creating method dictionary"
|
|
429 |
"instance creation"
|
|
430 |
basicNew basicNew: new new:
|
|
431 |
"accessing class hierarchy"
|
|
432 |
allSubclasses #'allSubclassesWithLevelDo:startingLevel:' allSuperclasses subclasses superclass withAllSubclasses withAllSuperclasses
|
|
433 |
"accessing method dictionary"
|
1109
|
434 |
allSelectors changeRecordsAt: compiledMethodAt: #'compiledMethodAt:ifAbsent:' firstCommentAt: lookupSelector: selectors selectorsDo: selectorsWithArgs:
|
|
435 |
"slow but useful ->" sourceCodeAt: sourceCodeAt:ifAbsent: sourceMethodAt: sourceMethodAt:ifAbsent:
|
1108
|
436 |
"accessing instances and variables"
|
1109
|
437 |
allClassVarNames allInstVarNames allSharedPools classVarNames instVarNames instanceCount sharedPools
|
|
438 |
"someInstance" subclassInstVarNames
|
1108
|
439 |
"testing class hierarchy"
|
|
440 |
inheritsFrom: kindOfSubclass
|
|
441 |
"testing method dictionary"
|
1109
|
442 |
canUnderstand: classThatUnderstands: hasMethods includesSelector: #'scopeHas:ifTrue:'
|
|
443 |
whichClassIncludesSelector:
|
|
444 |
whichSelectorsAccess: whichSelectorsReferTo: #'whichSelectorsReferTo:special:byte:' whichSelectorsStoreInto:
|
1108
|
445 |
"enumerating"
|
|
446 |
"user interface"
|
|
447 |
"private"
|
|
448 |
indexIfCompact
|
1109
|
449 |
"ST/X testing method dictionary"
|
|
450 |
implements:
|
1108
|
451 |
) do: [:sel | Approved add: sel].
|
1089
|
452 |
|
|
453 |
"ClassDescription"
|
1109
|
454 |
#(
|
|
455 |
"initialize-release"
|
1108
|
456 |
"accessing"
|
|
457 |
classVersion isMeta name theNonMetaClass
|
|
458 |
"copying"
|
|
459 |
"printing"
|
|
460 |
classVariablesString instanceVariablesString sharedPoolsString
|
|
461 |
"instance variables"
|
|
462 |
checkForInstVarsOK:
|
|
463 |
"method dictionary"
|
|
464 |
"organization"
|
|
465 |
category organization whichCategoryIncludesSelector:
|
|
466 |
"compiling"
|
|
467 |
acceptsLoggingOfCompilation wantsChangeSetLogging
|
|
468 |
"fileIn/Out"
|
|
469 |
definition
|
|
470 |
"private"
|
1109
|
471 |
"ST/X queries"
|
|
472 |
theMetaclass theNonMetaclass
|
1108
|
473 |
) do: [:sel | Approved add: sel].
|
1089
|
474 |
|
|
475 |
"Class"
|
1109
|
476 |
#(
|
|
477 |
"initialize-release"
|
1108
|
478 |
"accessing"
|
|
479 |
classPool
|
|
480 |
"testing"
|
|
481 |
"copying"
|
|
482 |
"class name"
|
|
483 |
"instance variables"
|
|
484 |
"class variables"
|
|
485 |
classVarAt: classVariableAssociationAt:
|
|
486 |
"pool variables"
|
|
487 |
"compiling"
|
|
488 |
"subclass creation"
|
|
489 |
"fileIn/Out"
|
1109
|
490 |
"ST/X queries"
|
|
491 |
nameSpace nameWithoutPrefix nameWithoutNameSpacePrefix
|
1108
|
492 |
) do: [:sel | Approved add: sel].
|
1089
|
493 |
|
|
494 |
"Metaclass"
|
|
495 |
#("initialize-release"
|
1108
|
496 |
"accessing"
|
|
497 |
isSystemDefined soleInstance
|
|
498 |
"copying" "instance creation" "instance variables"
|
|
499 |
"pool variables" "class hierarchy" "compiling"
|
|
500 |
"fileIn/Out"
|
|
501 |
nonTrivial
|
|
502 |
) do: [:sel | Approved add: sel].
|
1089
|
503 |
|
|
504 |
"Context, BlockContext"
|
1108
|
505 |
#(
|
|
506 |
receiver client method receiver tempAt:
|
|
507 |
"debugger access"
|
|
508 |
mclass pc selector sender shortStack sourceCode tempNames tempsAndValues
|
|
509 |
"controlling" "printing" "system simulation"
|
|
510 |
"initialize-release"
|
|
511 |
"accessing"
|
|
512 |
hasMethodReturn home numArgs
|
|
513 |
"evaluating"
|
|
514 |
value #'value:ifError:' #'value:value:' #'value:value:value:' #'value:value:value:value:' #'valueWithArguments:'
|
|
515 |
"controlling" "scheduling" "instruction decoding" "printing" "private" "system simulation" ) do: [:sel | Approved add: sel].
|
|
516 |
#(value: "<- Association has it as a store"
|
|
517 |
) do: [:sel | AddAndRemove add: sel].
|
1089
|
518 |
|
|
519 |
"Message"
|
1108
|
520 |
#(
|
|
521 |
"inclass, instance creation"
|
|
522 |
selector: #'selector:argument:' #'selector:arguments:'
|
|
523 |
"accessing"
|
|
524 |
argument argument: arguments sends:
|
|
525 |
"printing" "sending"
|
|
526 |
) do: [:sel | Approved add: sel].
|
|
527 |
#(
|
|
528 |
"private"
|
|
529 |
#'setSelector:arguments:'
|
|
530 |
) do: [:sel | AddAndRemove add: sel].
|
1089
|
531 |
|
|
532 |
"Magnitude"
|
1108
|
533 |
#(
|
|
534 |
"comparing"
|
|
535 |
< <= > >= #'between:and:'
|
|
536 |
"testing"
|
|
537 |
max: min: min:max:
|
|
538 |
) do: [:sel | Approved add: sel].
|
1089
|
539 |
|
|
540 |
"Date, Time"
|
1108
|
541 |
#(
|
|
542 |
"in class, instance creation"
|
|
543 |
fromDays: fromSeconds: fromString: #'newDay:month:year:' #'newDay:year:' today
|
|
544 |
"in class, general inquiries"
|
|
545 |
dateAndTimeNow dayOfWeek: #'daysInMonth:forYear:' daysInYear: #'firstWeekdayOfMonth:year:' indexOfMonth: leapYear: nameOfDay: nameOfMonth:
|
|
546 |
"accessing"
|
1961
|
547 |
day isLeapYear "leap" monthIndex monthName weekday year
|
1108
|
548 |
"arithmetic"
|
|
549 |
addDays: subtractDate: subtractDays:
|
|
550 |
"comparing"
|
|
551 |
"inquiries"
|
1961
|
552 |
dayOfMonth daysInMonth daysInYear daysLeftInMonth daysLeftInYear firstDayOfMonth previous:
|
1108
|
553 |
"converting"
|
1961
|
554 |
asSeconds asDays
|
1108
|
555 |
"printing"
|
|
556 |
mmddyy mmddyyyy printFormat: printOn:format:
|
|
557 |
"private"
|
|
558 |
firstDayOfMonthIndex: weekdayIndex
|
|
559 |
|
|
560 |
"in class, instance creation"
|
|
561 |
fromSeconds: now
|
|
562 |
"in class, general inquiries"
|
|
563 |
dateAndTimeFromSeconds: dateAndTimeNow millisecondClockValue millisecondsToRun: totalSeconds
|
|
564 |
"accessing"
|
|
565 |
hours minutes seconds
|
|
566 |
"arithmetic"
|
|
567 |
addTime: subtractTime:
|
|
568 |
"comparing"
|
|
569 |
"printing"
|
|
570 |
intervalString print24
|
|
571 |
"converting"
|
1961
|
572 |
"st/x"
|
|
573 |
dayOfWeek abbreviatedDayName abbreviatedMonthName
|
|
574 |
abbreviatedMonthNameForLanguage: dayCount dayInWeek dayInYear
|
|
575 |
monthNameForLanguage: weekInYear daysSince: daysUntil:
|
|
576 |
asTimestamp asDate
|
|
577 |
timeZoneDeltaInMinutes asTime asTimeDuration asMilliseconds
|
|
578 |
asUtcTimestamp utcSecondsSince1901 printStringIso8601Format
|
|
579 |
printString12HourFormat printString24HourFormat
|
|
580 |
days utcOffset millisecondDeltaFrom: secondDeltaFrom:
|
1108
|
581 |
) do: [:sel | Approved add: sel].
|
|
582 |
#(
|
|
583 |
"private"
|
|
584 |
hours: #'hours:minutes:seconds:' #'day:year:'
|
|
585 |
) do: [:sel | AddAndRemove add: sel].
|
1089
|
586 |
|
|
587 |
"Number"
|
1108
|
588 |
#(
|
|
589 |
"in class"
|
|
590 |
#'readFrom:base:'
|
|
591 |
"arithmetic"
|
|
592 |
* + - / // \\ abs negated quo: reciprocal rem:
|
1089
|
593 |
"mathematical functions"
|
1108
|
594 |
arcCos arcSin arcTan arcTan: cos exp floorLog: ln log log: raisedTo: raisedToInteger: sin sqrt squared tan
|
1089
|
595 |
"truncation and round off"
|
1108
|
596 |
ceiling #'detentBy:atMultiplesOf:snap:' floor roundTo: roundUpTo: rounded truncateTo: truncated
|
1089
|
597 |
"comparing"
|
|
598 |
"testing"
|
1108
|
599 |
even isDivisibleBy: isInf isInfinite isNaN isZero negative odd positive sign strictlyPositive
|
1089
|
600 |
"converting"
|
1108
|
601 |
@ asInteger asNumber asPoint asSmallAngleDegrees degreesToRadians radiansToDegrees
|
|
602 |
"intervals"
|
|
603 |
to: #'to:by:'
|
|
604 |
"printing"
|
|
605 |
printStringBase: storeStringBase:
|
|
606 |
|
|
607 |
"ST/X in class"
|
|
608 |
#'readFrom:base:'
|
|
609 |
"ST/X intervals"
|
|
610 |
downTo: #'downTo:by:'
|
|
611 |
"ST/X printing"
|
|
612 |
radixPrintStringRadix: printStringRadix: storeStringRadix:
|
|
613 |
) do: [:sel | Approved add: sel].
|
|
614 |
|
1089
|
615 |
"Integer"
|
1108
|
616 |
#(
|
|
617 |
"in class"
|
|
618 |
primesUpTo:
|
|
619 |
"testing"
|
|
620 |
isPowerOfTwo
|
|
621 |
"arithmetic"
|
|
622 |
alignedTo:
|
|
623 |
"comparing"
|
|
624 |
"truncation and round off"
|
|
625 |
atRandom normalize
|
|
626 |
"enumerating"
|
|
627 |
timesRepeat:
|
|
628 |
"mathematical functions"
|
|
629 |
degreeCos degreeSin factorial gcd: lcm: take:
|
|
630 |
"bit manipulation"
|
|
631 |
<< >> allMask: anyMask: bitAnd: bitClear: bitInvert bitInvert32 bitOr: bitShift: bitXor: lowBit noMask:
|
|
632 |
"converting"
|
|
633 |
asCharacter asColorOfDepth: asFloat asFraction asHexDigit
|
|
634 |
"printing"
|
|
635 |
asStringWithCommas hex hex8 radix:
|
|
636 |
"system primitives"
|
|
637 |
lastDigit #'replaceFrom:to:with:startingAt:'
|
|
638 |
"private" "benchmarks"
|
1089
|
639 |
|
1108
|
640 |
"ST/X printing"
|
1109
|
641 |
hexPrintString isPrime
|
1108
|
642 |
|
|
643 |
) do: [:sel | Approved add: sel].
|
1106
|
644 |
|
1089
|
645 |
"SmallInteger, LargeNegativeInteger, LargePositiveInteger"
|
1108
|
646 |
#(
|
|
647 |
"arithmetic"
|
|
648 |
"bit manipulation"
|
|
649 |
highBit
|
|
650 |
"testing" "comparing" "copying" "converting" "printing"
|
|
651 |
"system primitives"
|
|
652 |
digitAt: digitLength
|
|
653 |
"private"
|
|
654 |
#'fromString:radix:'
|
|
655 |
) do: [:sel | Approved add: sel].
|
1089
|
656 |
#((#'digitAt:put:') ) do: [:sel | AddAndRemove add: sel].
|
|
657 |
|
|
658 |
"Float"
|
1108
|
659 |
#(
|
|
660 |
"arithmetic"
|
|
661 |
"mathematical functions"
|
|
662 |
reciprocalFloorLog: reciprocalLogBase2 timesTwoPower:
|
|
663 |
"comparing" "testing"
|
|
664 |
"truncation and round off"
|
|
665 |
exponent fractionPart integerPart significand significandAsInteger
|
|
666 |
"converting"
|
|
667 |
asApproximateFraction asIEEE32BitWord asTrueFraction
|
|
668 |
"copying"
|
|
669 |
) do: [:sel | Approved add: sel].
|
1089
|
670 |
|
|
671 |
"Fraction, Random"
|
1108
|
672 |
#(
|
|
673 |
denominator numerator reduced next nextValue
|
|
674 |
) do: [:sel | Approved add: sel].
|
|
675 |
#(
|
|
676 |
#'setNumerator:denominator:'
|
|
677 |
) do: [:sel | AddAndRemove add: sel].
|
1089
|
678 |
|
|
679 |
"Collection"
|
1108
|
680 |
#(
|
|
681 |
"accessing"
|
|
682 |
anyOne
|
|
683 |
"testing"
|
|
684 |
includes: includesAllOf: includesAnyOf: includesSubstringAnywhere: isEmpty notEmpty isSequenceable occurrencesOf:
|
|
685 |
"enumerating"
|
|
686 |
collect: #'collect:thenSelect:' count: detect: #'detect:ifNone:' detectMax: detectMin: detectSum: #'inject:into:' reject: select: #'select:thenCollect:'
|
|
687 |
"converting"
|
|
688 |
asBag asCharacterSet asSet asSortedArray asSortedCollection asSortedCollection:
|
1491
|
689 |
asStringWith:
|
1108
|
690 |
"printing"
|
|
691 |
"private"
|
|
692 |
maxSize
|
|
693 |
"arithmetic"
|
|
694 |
"math functions"
|
|
695 |
average max median min range sum
|
|
696 |
) do: [:sel | Approved add: sel].
|
|
697 |
|
|
698 |
#(
|
|
699 |
"adding"
|
|
700 |
add: addAll: addIfNotPresent:
|
|
701 |
"removing"
|
|
702 |
remove: #'remove:ifAbsent:' removeAll: removeAllFoundIn: removeAllSuchThat: #'remove:ifAbsent:'
|
|
703 |
) do: [:sel | AddAndRemove add: sel].
|
1089
|
704 |
|
|
705 |
"SequenceableCollection"
|
1108
|
706 |
#(
|
|
707 |
"comparing"
|
|
708 |
hasEqualElements:
|
|
709 |
"accessing" allButFirst allButLast at:ifAbsent: atAll: atPin: atRandom: atWrap:
|
|
710 |
fifth first fourth last second sixth third
|
|
711 |
identityIndexOf: #'identityIndexOf:startingAt:' #'identityIndexOf:ifAbsent:' #'identityIndexOf:startingAt:ifAbsent:'
|
|
712 |
indexOf: #'indexOf:startingAt:' #'indexOf:ifAbsent:' #'indexOf:startingAt:ifAbsent:'
|
|
713 |
lastIndexOf: #'lastIndexOf:startingAt:' #'lastIndexOf:ifAbsent:' #'lastIndexOf:startingAt:ifAbsent:'
|
|
714 |
#'indexOfSubCollection:'
|
|
715 |
#'indexOfSubCollection:ifAbsent:'
|
|
716 |
#'indexOfSubCollection:startingAt:'
|
|
717 |
#'indexOfSubCollection:startingAt:ifAbsent:'
|
|
718 |
#'lastIndexOfSubCollection:'
|
|
719 |
#'lastIndexOfSubCollection:ifAbsent:'
|
|
720 |
#'lastIndexOfSubCollection:startingAt:'
|
|
721 |
#'lastIndexOfSubCollection:startingAt:ifAbsent:'
|
1107
|
722 |
|
1108
|
723 |
"removing"
|
|
724 |
"copying"
|
|
725 |
, copyAfterLast: #'copyAt:put:' #'copyFrom:to:' #'copyReplaceAll:with:' #'copyReplaceFrom:to:with:' copyUpTo: copyUpToLast: copyWith: copyWithout: copyWithoutAll: #'forceTo:paddingWith:' shuffled sortBy:
|
|
726 |
"enumerating"
|
|
727 |
collectWithIndex: findFirst: findLast: pairsCollect: #'with:collect:' withIndexCollect: polynomialEval:
|
|
728 |
"converting"
|
|
729 |
asArray asDictionary asFloatArray asIntegerArray asStringWithCr asWordArray reversed
|
|
730 |
"private"
|
|
731 |
#'copyReplaceAll:with:asTokens:'
|
1089
|
732 |
|
1108
|
733 |
"ST/X copying"
|
|
734 |
copyWithoutLast: copyLast: copyFrom: copyTo:
|
|
735 |
"ST/X testing"
|
|
736 |
longestCommonPrefix
|
|
737 |
) do: [:sel | Approved add: sel].
|
|
738 |
|
|
739 |
#( swap:with:
|
|
740 |
) do: [:sel | AddAndRemove add: sel].
|
1106
|
741 |
|
1089
|
742 |
"ArrayedCollection, Bag"
|
1108
|
743 |
#(
|
|
744 |
"private"
|
|
745 |
defaultElement
|
|
746 |
"sorting"
|
|
747 |
isSorted
|
|
748 |
"accessing"
|
|
749 |
cumulativeCounts sortedCounts sortedElements
|
|
750 |
"testing" "adding"
|
|
751 |
#'add:withOccurrences:'
|
|
752 |
"removing" "enumerating"
|
1089
|
753 |
) do: [:sel | Approved add: sel].
|
1108
|
754 |
|
|
755 |
#(
|
|
756 |
#'mergeSortFrom:to:by:' sort sort: add: #'add:withOccurrences:'
|
|
757 |
"private"
|
|
758 |
setDictionary
|
|
759 |
) do: [:sel | AddAndRemove add: sel].
|
1089
|
760 |
|
|
761 |
"Other messages that modify the receiver"
|
1108
|
762 |
#(
|
|
763 |
#'atAll:put:' #'atAll:putAll:' atAllPut: #'atWrap:put:'
|
|
764 |
#'replaceAll:with:' #'replaceFrom:to:with:' removeFirst removeLast
|
|
765 |
"ST/X filling & replacing"
|
|
766 |
reverse
|
|
767 |
) do: [:sel | AddAndRemove add: sel].
|
1089
|
768 |
|
|
769 |
self initialize2.
|
|
770 |
|
|
771 |
"
|
|
772 |
MethodFinder new initialize.
|
|
773 |
MethodFinder new organizationFiltered: Set
|
|
774 |
"
|
1106
|
775 |
|
1109
|
776 |
"Modified: / 13.11.2001 / 18:58:52 / cg"
|
1089
|
777 |
!
|
|
778 |
|
|
779 |
initialize2
|
|
780 |
"The methods we are allowed to use. (MethodFinder new initialize) "
|
|
781 |
|
|
782 |
"Set"
|
1108
|
783 |
#(
|
|
784 |
"in class"
|
|
785 |
sizeFor:
|
|
786 |
"testing" "adding" "removing" "enumerating"
|
|
787 |
"private"
|
|
788 |
array findElementOrNil:
|
|
789 |
"accessing"
|
|
790 |
someElement
|
|
791 |
) do: [:sel | Approved add: sel].
|
1089
|
792 |
|
|
793 |
"Dictionary, IdentityDictionary, IdentitySet"
|
1108
|
794 |
#(
|
|
795 |
"accessing"
|
|
796 |
associationAt: #'associationAt:ifAbsent:' #'at:ifPresent:' keyAtIdentityValue: #'keyAtIdentityValue:ifAbsent:' keyAtValue: #'keyAtValue:ifAbsent:' keys
|
|
797 |
"testing"
|
|
798 |
includesKey:
|
|
799 |
) do: [:sel | Approved add: sel].
|
|
800 |
#(
|
|
801 |
removeKey: #'removeKey:ifAbsent:'
|
|
802 |
) do: [:sel | AddAndRemove add: sel].
|
1089
|
803 |
|
|
804 |
"LinkedList, Interval, MappedCollection"
|
|
805 |
#(
|
1108
|
806 |
"in class"
|
|
807 |
#'from:to:' #'from:to:by:'
|
|
808 |
"accessing"
|
|
809 |
contents) do: [:sel | Approved add: sel].
|
|
810 |
#(
|
|
811 |
"adding"
|
|
812 |
addFirst: addLast:) do: [:sel | AddAndRemove add: sel].
|
1089
|
813 |
|
|
814 |
"OrderedCollection, SortedCollection"
|
1108
|
815 |
#(
|
|
816 |
"accessing"
|
|
817 |
after: before:
|
|
818 |
"copying"
|
|
819 |
copyEmpty
|
|
820 |
"adding"
|
|
821 |
growSize
|
|
822 |
"removing" "enumerating" "private"
|
|
823 |
"accessing"
|
|
824 |
sortBlock) do: [:sel | Approved add: sel].
|
|
825 |
#(
|
|
826 |
"adding"
|
|
827 |
#'add:after:' #'add:afterIndex:' #'add:before:' addAllFirst: addAllLast: addFirst: addLast:
|
|
828 |
"removing"
|
|
829 |
removeAt: removeFirst removeLast
|
|
830 |
"accessing"
|
|
831 |
sortBlock:) do: [:sel | AddAndRemove add: sel].
|
1089
|
832 |
|
|
833 |
"Character"
|
1108
|
834 |
#(
|
|
835 |
"in class, instance creation"
|
|
836 |
allCharacters digitValue: new separators
|
|
837 |
"accessing untypeable characters"
|
|
838 |
backspace cr enter lf linefeed nbsp newPage space tab
|
|
839 |
"constants"
|
|
840 |
alphabet characterTable
|
|
841 |
"accessing"
|
|
842 |
asciiValue digitValue
|
|
843 |
"comparing"
|
|
844 |
"testing"
|
|
845 |
isAlphaNumeric isDigit isLetter isLowercase isSafeForHTTP isSeparator isSpecial isUppercase isVowel tokenish
|
|
846 |
"copying"
|
|
847 |
"converting"
|
|
848 |
asIRCLowercase asLowercase asUppercase
|
1089
|
849 |
) do: [:sel | Approved add: sel].
|
|
850 |
|
|
851 |
"String"
|
1108
|
852 |
#(
|
|
853 |
"in class, instance creation"
|
|
854 |
crlf fromPacked:
|
|
855 |
"primitives"
|
|
856 |
#'findFirstInString:inSet:startingAt:' #'indexOfAscii:inString:startingAt:' "internet" valueOfHtmlEntity:
|
|
857 |
"accessing"
|
|
858 |
byteAt: endsWithDigit #'findAnySubStr:startingAt:' findBetweenSubStrs:
|
|
859 |
#'findDelimiters:startingAt:'
|
|
860 |
#'findString:startingAt:' #'findString:startingAt:caseSensitive:'
|
|
861 |
findTokens: #'findTokens:includes:' #'findTokens:keep:'
|
|
862 |
includesSubString: #'includesSubstring:caseSensitive:'
|
|
863 |
#'indexOf:startingAt:'
|
|
864 |
indexOfAnyOf: #'indexOfAnyOf:ifAbsent:' #'indexOfAnyOf:startingAt:' #'indexOfAnyOf:startingAt:ifAbsent:'
|
|
865 |
lineCorrespondingToIndex: lineCount lineNumber:
|
|
866 |
#'skipAnySubStr:startingAt:' #'skipDelimiters:startingAt:' startsWithDigit
|
|
867 |
"comparing"
|
1109
|
868 |
alike: beginsWith: caseSensitiveLessOrEqual: charactersExactlyMatching: compare: crc16
|
|
869 |
endsWith: endsWithAnyOf: sameAs:
|
|
870 |
#'startingAt:match:startingAt:'
|
1108
|
871 |
"copying"
|
|
872 |
#'copyReplaceTokens:with:' #'padded:to:with:'
|
|
873 |
"converting"
|
|
874 |
asByteArray asDate asDisplayText asFileName asHtml asLegalSelector asPacked asParagraph asText asTime asUnHtml asUrl asUrlRelativeTo:
|
|
875 |
#capitalized compressWithTable: contractTo: correctAgainst:
|
|
876 |
encodeForHTTP initialIntegerOrNil keywords quoted sansPeriodSuffix
|
|
877 |
splitInteger stemAndNumericSuffix substrings surroundedBySingleQuotes
|
|
878 |
truncateWithElipsisTo: withBlanksTrimmed withFirstCharacterDownshifted
|
|
879 |
withNoLineLongerThan: withSeparatorsCompacted withoutLeadingDigits
|
|
880 |
withoutTrailingBlanks
|
|
881 |
"displaying" "printing"
|
|
882 |
"system primitives"
|
|
883 |
#'compare:with:collated:'
|
|
884 |
"Celeste"
|
|
885 |
withCRs
|
|
886 |
"internet"
|
|
887 |
decodeMimeHeader decodeQuotedPrintable replaceHtmlCharRefs unescapePercents withInternetLineEndings withSqueakLineEndings withoutQuoting
|
|
888 |
"testing"
|
|
889 |
isAllSeparators lastSpacePosition
|
|
890 |
"paragraph support"
|
|
891 |
indentationIfBlank:
|
1109
|
892 |
"arithmetic"
|
|
893 |
"ST/X copying"
|
|
894 |
paddedTo: paddedTo:with: centerPaddedTo: centerPaddedTo:with:
|
|
895 |
decimalPaddedTo:and:at:
|
|
896 |
leftPaddedTo: leftPaddedTo:with:
|
|
897 |
chopTo: contractAtBeginningTo: contractAtEndTo: contractTo:
|
|
898 |
"ST/X comparing"
|
|
899 |
compareWith: sameCharacters: sameEmphasisAs: sameStringAndEmphasisAs:
|
|
900 |
"ST/X searching"
|
|
901 |
indexOfSeparator indexOfSeparatorStartingAt:
|
|
902 |
lastIndexOfSeparator lastIndexOfSeparatorStartingAt:
|
|
903 |
indexOfNonSeparatorStartingAt:
|
|
904 |
"ST/X converting"
|
|
905 |
asUppercaseFirst
|
|
906 |
asCollectionOfWords asCollectionOfLines
|
|
907 |
asCollectionOfSubstringsSeparatedBy: asCollectionOfSubstringsSeparatedByAny:
|
|
908 |
"Ansi"
|
|
909 |
addLineDelimiters
|
|
910 |
) do: [:sel | Approved add: sel].
|
1089
|
911 |
#(#'byteAt:put:' translateToLowercase match:) do: [:sel | AddAndRemove add: sel].
|
|
912 |
|
|
913 |
"Symbol"
|
1108
|
914 |
#(
|
|
915 |
"in class, private"
|
|
916 |
hasInterned:ifTrue:
|
|
917 |
"access"
|
|
918 |
morePossibleSelectorsFor: possibleSelectorsFor: selectorsContaining: #'thatStarts:skipping:'
|
|
919 |
"accessing" "comparing" "copying" "converting" "printing"
|
|
920 |
"testing"
|
|
921 |
isInfix isKeyword isPvtSelector isUnary) do: [:sel | Approved add: sel].
|
1089
|
922 |
|
|
923 |
"Array"
|
1108
|
924 |
#(
|
|
925 |
"comparing"
|
|
926 |
"converting"
|
|
927 |
evalStrings
|
|
928 |
"printing" "private"
|
|
929 |
hasLiteralSuchThat:) do: [:sel | Approved add: sel].
|
1089
|
930 |
|
|
931 |
"Array2D"
|
1108
|
932 |
#(
|
|
933 |
"access"
|
|
934 |
#'at:at:' atCol: #'atCol:put:' atRow: extent #'extent:fromArray:' height width #'width:height:type:'
|
|
935 |
) do: [:sel | Approved add: sel].
|
1089
|
936 |
#(#'at:at:add:' #'at:at:put:' #'atRow:put:' ) do: [:sel | AddAndRemove add: sel].
|
|
937 |
|
|
938 |
"ByteArray"
|
1108
|
939 |
#(
|
|
940 |
"accessing"
|
|
941 |
doubleWordAt: wordAt:
|
|
942 |
"platform independent access"
|
|
943 |
#'longAt:bigEndian:' #'shortAt:bigEndian:' #'unsignedLongAt:bigEndian:' #'unsignedShortAt:bigEndian:'
|
|
944 |
"converting") do: [:sel | Approved add: sel].
|
1089
|
945 |
#(#'doubleWordAt:put:' #'wordAt:put:' #'longAt:put:bigEndian:' #'shortAt:put:bigEndian:' #'unsignedLongAt:put:bigEndian:' #'unsignedShortAt:put:bigEndian:'
|
|
946 |
) do: [:sel | AddAndRemove add: sel].
|
|
947 |
|
|
948 |
"FloatArray" "Dont know what happens when prims not here"
|
1108
|
949 |
false ifTrue: [#(
|
|
950 |
"accessing"
|
|
951 |
"arithmetic"
|
|
952 |
*= += -= /=
|
|
953 |
"comparing"
|
|
954 |
"primitives-plugin"
|
|
955 |
primAddArray: primAddScalar: primDivArray: primDivScalar: primMulArray: primMulScalar: primSubArray: primSubScalar:
|
|
956 |
"primitives-translated"
|
|
957 |
#'primAddArray:withArray:from:to:' #'primMulArray:withArray:from:to:' #'primSubArray:withArray:from:to:'
|
|
958 |
"converting" "private" "user interface"
|
|
959 |
) do: [:sel | Approved add: sel].
|
1089
|
960 |
].
|
|
961 |
|
|
962 |
"IntegerArray, WordArray"
|
|
963 |
"RunArray"
|
1108
|
964 |
#(
|
|
965 |
"in class, instance creation"
|
|
966 |
#'runs:values:' scanFrom:
|
|
967 |
"accessing"
|
|
968 |
runLengthAt:
|
|
969 |
"adding" "copying"
|
|
970 |
"private"
|
|
971 |
runs values
|
|
972 |
) do: [:sel | Approved add: sel].
|
1089
|
973 |
#(coalesce #'addLast:times:' #'repeatLast:ifEmpty:' repeatLastIfEmpty:
|
|
974 |
) do: [:sel | AddAndRemove add: sel].
|
|
975 |
|
|
976 |
"Stream -- many operations change its state"
|
1108
|
977 |
#(
|
|
978 |
"testing"
|
|
979 |
atEnd) do: [:sel | Approved add: sel].
|
|
980 |
#(
|
|
981 |
"accessing"
|
|
982 |
next: nextMatchAll: nextMatchFor: upToEnd
|
|
983 |
#'next:put:' nextPut: nextPutAll:
|
|
984 |
"printing" print: printHtml:
|
1089
|
985 |
) do: [:sel | AddAndRemove add: sel].
|
|
986 |
|
|
987 |
"PositionableStream"
|
1108
|
988 |
#(
|
|
989 |
"accessing"
|
|
990 |
contentsOfEntireFile originalContents peek peekFor: "testing"
|
|
991 |
"positioning"
|
|
992 |
position
|
|
993 |
) do: [:sel | Approved add: sel].
|
1089
|
994 |
#(nextDelimited: nextLine upTo: position: reset resetContents setToEnd skip: skipTo: upToAll: ) do: [:sel | AddAndRemove add: sel].
|
1108
|
995 |
"Because it is so difficult to test the result of an operation on a Stream
|
|
996 |
(you have to supply another Stream in the same state),
|
|
997 |
we don't support Streams beyond the basics.
|
|
998 |
We want to find the messages that convert Streams to other things."
|
1089
|
999 |
|
|
1000 |
"ReadWriteStream"
|
1108
|
1001 |
#(
|
|
1002 |
"file status"
|
|
1003 |
closed) do: [:sel | Approved add: sel].
|
|
1004 |
#(
|
|
1005 |
"accessing"
|
|
1006 |
next: on: ) do: [:sel | AddAndRemove add: sel].
|
1089
|
1007 |
|
|
1008 |
"WriteStream"
|
1108
|
1009 |
#(
|
|
1010 |
"in class, instance creation"
|
|
1011 |
on:from:to: with: with:from:to:
|
1089
|
1012 |
) do: [:sel | Approved add: sel].
|
1108
|
1013 |
#(
|
|
1014 |
"positioning"
|
|
1015 |
resetToStart
|
|
1016 |
"character writing"
|
|
1017 |
crtab crtab:) do: [:sel | AddAndRemove add: sel].
|
1089
|
1018 |
|
|
1019 |
"LookupKey, Association, Link"
|
1108
|
1020 |
#(
|
|
1021 |
"accessing"
|
|
1022 |
key nextLink) do: [:sel | Approved add: sel].
|
1089
|
1023 |
#(key: #'key:value:' nextLink:) do: [:sel | AddAndRemove add: sel].
|
|
1024 |
|
|
1025 |
"Point"
|
1108
|
1026 |
#(
|
|
1027 |
"in class, instance creation"
|
|
1028 |
#'r:degrees:' #'x:y:'
|
|
1029 |
"accessing"
|
|
1030 |
x y
|
|
1031 |
"comparing" "arithmetic" "truncation and round off"
|
|
1032 |
"polar coordinates"
|
|
1033 |
degrees r theta
|
|
1034 |
"point functions"
|
|
1035 |
bearingToPoint: crossProduct: dist: dotProduct: eightNeighbors #'flipBy:centerAt:' fourNeighbors grid:
|
|
1036 |
#'nearestPointAlongLineFrom:to:' #'nearestPointOnLineFrom:to:'
|
|
1037 |
normal normalized octantOf:
|
|
1038 |
#'onLineFrom:to:' #'onLineFrom:to:within:'
|
|
1039 |
quadrantOf: #'rotateBy:centerAt:' transposed unitVector
|
|
1040 |
"converting"
|
|
1041 |
asFloatPoint asIntegerPoint corner: extent: rect:
|
|
1042 |
"transforming"
|
|
1043 |
adhereTo: #'rotateBy:about:' scaleBy: #'scaleFrom:to:' translateBy: "copying"
|
|
1044 |
"interpolating"
|
|
1045 |
#'interpolateTo:at:'
|
|
1046 |
) do: [:sel | Approved add: sel].
|
1089
|
1047 |
|
|
1048 |
"Rectangle"
|
|
1049 |
#("in class, instance creation" #'center:extent:' encompassing: #'left:right:top:bottom:'
|
|
1050 |
merging: #'origin:corner:' #'origin:extent:'
|
1108
|
1051 |
"accessing"
|
|
1052 |
area bottom bottomCenter bottomLeft bottomRight boundingBox center corner corners innerCorners
|
|
1053 |
left leftCenter origin right rightCenter top topCenter topLeft topRight
|
|
1054 |
"comparing"
|
|
1055 |
"rectangle functions"
|
|
1056 |
#'adjustTo:along:' amountToTranslateWithin: areasOutside: #'bordersOn:along:' encompass:
|
|
1057 |
expandBy: extendBy: #'forPoint:closestSideDistLen:'
|
|
1058 |
insetBy: #'insetOriginBy:cornerBy:' intersect:
|
|
1059 |
merge: pointNearestTo: quickMerge: #'rectanglesAt:height:'
|
|
1060 |
sideNearestTo: translatedToBeWithin:
|
|
1061 |
withBottom: withHeight: withLeft: withRight: #'withSide:setTo:' withTop: withWidth:
|
|
1062 |
"testing"
|
|
1063 |
containsPoint: containsRect: hasPositiveExtent intersects: isTall isWide
|
|
1064 |
"truncation and round off"
|
|
1065 |
"transforming"
|
|
1066 |
#'align:with:' centeredBeneath: newRectFrom: squishedWithin: "copying"
|
1089
|
1067 |
) do: [:sel | Approved add: sel].
|
|
1068 |
|
|
1069 |
"Color"
|
1108
|
1070 |
#(
|
|
1071 |
"in class, instance creation"
|
|
1072 |
colorFrom: #'colorFromPixelValue:depth:' fromRgbTriplet: gray: #'h:s:v:' #'r:g:b:' #'r:g:b:alpha:' #'r:g:b:range:'
|
|
1073 |
"ST/X in class, instance creation"
|
|
1074 |
colorNamed:
|
|
1075 |
"named colors"
|
|
1076 |
black blue brown cyan darkGray gray green lightBlue lightBrown lightCyan lightGray lightGreen lightMagenta lightOrange lightRed lightYellow
|
|
1077 |
magenta orange red transparent veryDarkGray veryLightGray veryVeryDarkGray veryVeryLightGray white yellow
|
|
1078 |
"other"
|
|
1079 |
colorNames indexedColors pixelScreenForDepth: quickHighLight:
|
|
1080 |
"access"
|
|
1081 |
alpha blue brightness green hue luminance red saturation
|
|
1082 |
"equality"
|
|
1083 |
"queries"
|
|
1084 |
isBitmapFill isBlack isGray isSolidFill isTranslucent isTranslucentColor
|
|
1085 |
"transformations"
|
|
1086 |
alpha: dansDarker darker lighter #'mixed:with:' muchLighter slightlyDarker slightlyLighter veryMuchLighter #'alphaMixed:with:'
|
|
1087 |
"groups of shades"
|
|
1088 |
darkShades: lightShades: #'mix:shades:' wheel:
|
|
1089 |
"printing"
|
|
1090 |
shortPrintString
|
|
1091 |
"other"
|
|
1092 |
colorForInsets rgbTriplet
|
|
1093 |
"conversions"
|
|
1094 |
asB3DColor asColor balancedPatternForDepth: bitPatternForDepth: closestPixelValue1 closestPixelValue2 closestPixelValue4 closestPixelValue8 dominantColor
|
|
1095 |
halfTonePattern1 halfTonePattern2 indexInMap: pixelValueForDepth: #'pixelWordFor:filledWith:' pixelWordForDepth: scaledPixelValue32
|
|
1096 |
"private"
|
1109
|
1097 |
privateAlpha privateBlue privateGreen privateRGB privateRed
|
|
1098 |
"copying"
|
1108
|
1099 |
"ST/X access"
|
1109
|
1100 |
redByte greenByte blueByte alphaByte rgbValue almostSameAs:
|
1089
|
1101 |
) do: [:sel | Approved add: sel].
|
|
1102 |
|
|
1103 |
" For each selector that requires a block argument, add (selector argNum)
|
|
1104 |
to the set Blocks."
|
1108
|
1105 |
"ourClasses _ #(Object Boolean True False UndefinedObject Behavior ClassDescription Class Metaclass MethodContext BlockContext Message Magnitude Date Time Number Integer
|
|
1106 |
SmallInteger LargeNegativeInteger LargePositiveInteger Float Fraction Random Collection SequenceableCollection ArrayedCollection Bag Set
|
|
1107 |
Dictionary IdentityDictionary IdentitySet LinkedList Interval MappedCollection OrderedCollection SortedCollection Character String Symbol Array
|
|
1108 |
Array2D ByteArray FloatArray IntegerArray WordArray RunArray Stream PositionableStream ReadWriteStream WriteStream LookupKey Association Link Point Rectangle Color).
|
1089
|
1109 |
ourClasses do: [:clsName | cls _ Smalltalk at: clsName.
|
|
1110 |
(cls selectors) do: [:aSel |
|
|
1111 |
((Approved includes: aSel) or: [AddAndRemove includes: aSel]) ifTrue: [
|
|
1112 |
(cls formalParametersAt: aSel) withIndexDo: [:tName :ind |
|
|
1113 |
(tName endsWith: 'Block') ifTrue: [
|
|
1114 |
Blocks add: (Array with: aSel with: ind)]]]]].
|
|
1115 |
"
|
1109
|
1116 |
#(
|
|
1117 |
(timesRepeat: 1 ) (indexOf:ifAbsent: 2 ) (pairsCollect: 1 ) (#'mergeSortFrom:to:by:' 3 )
|
|
1118 |
(#'ifNotNil:ifNil:' 1 ) (#'ifNotNil:ifNil:' 2 ) (ifNil: 1 ) (#'at:ifAbsent:' 2 )
|
|
1119 |
(#'ifNil:ifNotNil:' 1 ) (#'ifNil:ifNotNil:' 2 ) (ifNotNil: 1 ) (#'at:modify:' 2 )
|
|
1120 |
(#'identityIndexOf:ifAbsent:' 2 ) (sort: 1 ) (sortBlock: 1 )
|
|
1121 |
(detectMax: 1 ) (repeatLastIfEmpty: 1 ) (#'allSubclassesWithLevelDo:startingLevel:' 1 )
|
|
1122 |
(#'keyAtValue:ifAbsent:' 2 ) (in: 1 )
|
|
1123 |
(ifTrue: 1 ) (or: 1 ) (select: 1 ) (inject:into: 2 ) (#'ifKindOf:thenDo:' 2 )
|
|
1124 |
(#'forPoint:closestSideDistLen:' 2 ) (#'value:ifError:' 2 ) (selectorsDo: 1 )
|
|
1125 |
(removeAllSuchThat: 1 ) (#'keyAtIdentityValue:ifAbsent:' 2 ) (detectMin: 1 )
|
|
1126 |
(#'detect:ifNone:' 1 ) (#'ifTrue:ifFalse:' 1 ) (#'ifTrue:ifFalse:' 2 )
|
|
1127 |
(#'detect:ifNone:' 2 ) (hasLiteralSuchThat: 1 ) (#'indexOfAnyOf:ifAbsent:' 2 )
|
|
1128 |
(reject: 1 ) (newRectFrom: 1 ) (#'removeKey:ifAbsent:' 2 ) (#'at:ifPresent:' 2 )
|
|
1129 |
(#'associationAt:ifAbsent:' 2 ) (withIndexCollect: 1 ) (#'repeatLast:ifEmpty:' 2 )
|
|
1130 |
(findLast: 1 ) (#'indexOf:startingAt:ifAbsent:' 3 ) (#'remove:ifAbsent:' 2 )
|
|
1131 |
(#'ifFalse:ifTrue:' 1 ) (#'ifFalse:ifTrue:' 2 ) (#'caseOf:otherwise:' 2 ) (count: 1 ) (collect: 1 ) (sortBy: 1 ) (and: 1 ) (asSortedCollection: 1 )
|
|
1132 |
(#'with:collect:' 2 ) (#'sourceCodeAt:ifAbsent:' 2 ) (detect: 1 ) (#'scopeHas:ifTrue:' 2 ) (collectWithIndex: 1 ) (#'compiledMethodAt:ifAbsent:' 2 )
|
|
1133 |
(bindWithTemp: 1 ) (detectSum: 1 ) (#'indexOfSubCollection:startingAt:ifAbsent:' 3 ) (findFirst: 1 ) (#'sourceMethodAt:ifAbsent:' 2 ) (#'collect:thenSelect:' 1 )
|
|
1134 |
(#'collect:thenSelect:' 2 ) (#'select:thenCollect:' 1 ) (#'select:thenCollect:' 2 ) (ifFalse: 1 ) (#'indexOfAnyOf:startingAt:ifAbsent:' 3 ) (#'indentationIfBlank:' 1 )
|
1108
|
1135 |
) do: [:anArray |
|
|
1136 |
Blocks add: anArray].
|
1089
|
1137 |
|
1491
|
1138 |
#(
|
|
1139 |
(ifFalse: 1 )
|
|
1140 |
(ifTrue: 1 )
|
|
1141 |
(#'ifFalse:ifTrue:' 1 ) (#'ifFalse:ifTrue:' 2 )
|
|
1142 |
(#'ifTrue:ifFalse:' 1 ) (#'ifTrue:ifFalse:' 2 )
|
|
1143 |
) do: [:anArray |
|
|
1144 |
BlocksOptional add: anArray].
|
1089
|
1145 |
|
|
1146 |
"
|
|
1147 |
MethodFinder new initialize.
|
|
1148 |
MethodFinder new organizationFiltered: TranslucentColor class
|
|
1149 |
"
|
|
1150 |
"Do not forget class messages for each of these classes"
|
1108
|
1151 |
|
1109
|
1152 |
"Modified: / 13.11.2001 / 19:28:41 / cg"
|
1089
|
1153 |
!
|
|
1154 |
|
|
1155 |
load: dataWithAnswers
|
|
1156 |
"Find a function that takes the data and gives the answers. Odd list entries are data for it, even ones are the answers. nil input means data and answers were supplied already."
|
|
1157 |
" (MethodFinder new) load: #( (4 3) 7 (-10 5) -5 (-3 11) 8);
|
|
1158 |
findMessage "
|
|
1159 |
|
|
1160 |
dataWithAnswers ifNotNil: [
|
|
1161 |
data _ Array new: dataWithAnswers size // 2.
|
|
1162 |
1 to: data size do: [:ii | data at: ii put: (dataWithAnswers at: ii*2-1)].
|
|
1163 |
answers _ Array new: data size.
|
|
1164 |
1 to: answers size do: [:ii | answers at: ii put: (dataWithAnswers at: ii*2)]].
|
|
1165 |
data do: [:list |
|
|
1166 |
(list isKindOf: SequenceableCollection) ifFalse: [
|
|
1167 |
^ self warn: 'first and third items are not Arrays'].
|
|
1168 |
].
|
|
1169 |
argMap _ (1 to: data first size) asArray.
|
|
1170 |
data do: [:list | list size = argMap size ifFalse: [
|
|
1171 |
self warn: 'data arrays must all be the same size']].
|
|
1172 |
argMap size > 4 ifTrue: [self warn: 'No more than a receiver and
|
|
1173 |
three arguments allowed'].
|
|
1174 |
"Really only test receiver and three args."
|
|
1175 |
thisData _ data copy.
|
|
1176 |
mapStage _ mapList _ nil.
|
|
1177 |
!
|
|
1178 |
|
|
1179 |
noteDangerous
|
1104
|
1180 |
"Remember the methods with really bad side effects."
|
1089
|
1181 |
|
1104
|
1182 |
Dangerous _ Set new.
|
1089
|
1183 |
"Object accessing, testing, copying, dependent access, macpal, flagging"
|
1104
|
1184 |
#(addInstanceVarNamed:withValue: haltIfNil copyAddedStateFrom: veryDeepCopy veryDeepCopyWith: veryDeepFixupWith: veryDeepInner: addDependent: evaluate:wheneverChangeIn: codeStrippedOut: playSoundNamed: isThisEverCalled isThisEverCalled: logEntry logExecution logExit)
|
|
1185 |
do: [:sel | Dangerous add: sel].
|
1089
|
1186 |
|
|
1187 |
"Object error handling"
|
1104
|
1188 |
#(cannotInterpret: caseError confirm: confirm:orCancel: doesNotUnderstand: error: halt halt: notify: notify:at: primitiveFailed shouldNotImplement subclassResponsibility tryToDefineVariableAccess:)
|
|
1189 |
do: [:sel | Dangerous add: sel].
|
1089
|
1190 |
|
|
1191 |
"Object user interface"
|
1104
|
1192 |
#(basicInspect beep inform: inspect inspectWithLabel: notYetImplemented inspectElement )
|
|
1193 |
do: [:sel | Dangerous add: sel].
|
1089
|
1194 |
|
|
1195 |
"Object system primitives"
|
1104
|
1196 |
#(become: becomeForward: instVarAt:put: instVarNamed:put: nextInstance nextObject rootStubInImageSegment: someObject tryPrimitive:withArgs:)
|
|
1197 |
do: [:sel | Dangerous add: sel].
|
1089
|
1198 |
|
|
1199 |
"Object private"
|
1104
|
1200 |
#(errorImproperStore errorNonIntegerIndex errorNotIndexable errorSubscriptBounds: mustBeBoolean primitiveError: species storeAt:inTempFrame:)
|
|
1201 |
do: [:sel | Dangerous add: sel].
|
1089
|
1202 |
|
|
1203 |
"Object, translation support"
|
1104
|
1204 |
#(cCode: cCode:inSmalltalk: cCoerce:to: export: inline: returnTypeC: sharedCodeNamed:inCase: var:declareC:)
|
|
1205 |
do: [:sel | Dangerous add: sel].
|
1089
|
1206 |
|
|
1207 |
"Object, objects from disk, finalization. And UndefinedObject"
|
1104
|
1208 |
#(comeFullyUpOnReload: objectForDataStream: readDataFrom:size: rehash saveOnFile storeDataOn: actAsExecutor executor finalize retryWithGC:until: suspend)
|
|
1209 |
do: [:sel | Dangerous add: sel].
|
1089
|
1210 |
|
|
1211 |
"No Restrictions: Boolean, False, True, "
|
|
1212 |
|
|
1213 |
"Morph"
|
1104
|
1214 |
#(fullCopy copyRecordingIn:)
|
|
1215 |
do: [:sel | Dangerous add: sel].
|
1089
|
1216 |
|
|
1217 |
"Behavior"
|
1104
|
1218 |
#(obsolete confirmRemovalOf: copyOfMethodDictionary literalScannedAs:notifying: storeLiteral:on: addSubclass: removeSubclass: superclass:
|
1089
|
1219 |
"creating method dictionary" addSelector:withMethod: compile: compile:notifying: compileAll compileAllFrom: compress decompile: defaultSelectorForMethod: methodDictionary: recompile:from: recompileChanges removeSelector: compressedSourceCodeAt: selectorAtMethod:setClass: allInstances allSubInstances inspectAllInstances inspectSubInstances thoroughWhichSelectorsReferTo:special:byte: "enumerating" allInstancesDo: allSubInstancesDo: allSubclassesDo: allSuperclassesDo: selectSubclasses: selectSuperclasses: subclassesDo: withAllSubclassesDo:
|
|
1220 |
"user interface" allCallsOn: browse browseAllAccessesTo: browseAllCallsOn: browseAllStoresInto: "too slow->" crossReference removeUninstantiatedSubclassesSilently "too slow->" unreferencedInstanceVariables
|
|
1221 |
"private" becomeCompact becomeUncompact flushCache format:variable:words:pointers: format:variable:words:pointers:weak: printSubclassesOn:level: removeSelectorSimply:)
|
1104
|
1222 |
do: [:sel | Dangerous add: sel].
|
1089
|
1223 |
|
|
1224 |
"Others "
|
1104
|
1225 |
#("no tangible result" do: associationsDo:
|
1089
|
1226 |
"private" adaptToCollection:andSend: adaptToNumber:andSend: adaptToPoint:andSend: adaptToString:andSend: instVarAt:put: asDigitsToPower:do: combinations:atATimeDo: doWithIndex: pairsDo: permutationsDo: reverseDo: reverseWith:do: with:do: withIndexDo: asDigitsAt:in:do: combinationsAt:in:after:do: errorOutOfBounds permutationsStartingAt:do: fromUser)
|
1104
|
1227 |
do: [:sel | Dangerous add: sel].
|
1089
|
1228 |
|
|
1229 |
|
1104
|
1230 |
#( fileOutPrototype addSpareFields makeFileOutFile )
|
|
1231 |
do: [:sel | Dangerous add: sel].
|
|
1232 |
#(recompile:from: recompileAllFrom: recompileChanges asPrototypeWithFields: asPrototype addInstanceVarNamed:withValue: addInstanceVariable addClassVarName: removeClassVarName: findOrAddClassVarName: tryToDefineVariableAccess: instanceVariableNames: )
|
|
1233 |
do: [:sel | Dangerous add: sel].
|
1089
|
1234 |
|
|
1235 |
|
|
1236 |
!
|
|
1237 |
|
|
1238 |
organizationFiltered: aClass
|
1104
|
1239 |
"Return the organization of the class with all selectors defined in superclasses removed. (except those in Object)"
|
1089
|
1240 |
|
1104
|
1241 |
| org str |
|
|
1242 |
org _ aClass organization deepCopy.
|
|
1243 |
Dangerous do: [:sel |
|
|
1244 |
org removeElement: sel].
|
|
1245 |
Approved do: [:sel |
|
|
1246 |
org removeElement: sel].
|
|
1247 |
AddAndRemove do: [:sel |
|
|
1248 |
org removeElement: sel].
|
|
1249 |
str _ org printString copyWithout: $(.
|
|
1250 |
str _ '(', (str copyWithout: $) ).
|
|
1251 |
str _ str replaceAll: $' with: $".
|
|
1252 |
^ str
|
1089
|
1253 |
!
|
|
1254 |
|
|
1255 |
test2: anArray
|
1104
|
1256 |
"look for bad association"
|
1089
|
1257 |
|
1104
|
1258 |
anArray do: [:sub |
|
|
1259 |
sub class == Association ifTrue: [
|
|
1260 |
(#('true' '$a' '2' 'false') includes: sub value printString) ifFalse: [
|
|
1261 |
self error: 'bad assn'].
|
|
1262 |
(#('3' '5.6' 'x' '''abcd''') includes: sub key printString) ifFalse: [
|
|
1263 |
self error: 'bad assn'].
|
1089
|
1264 |
|
1104
|
1265 |
" sub value class == Association ifTrue: [
|
|
1266 |
self error: 'bad assn'].
|
|
1267 |
(sub value isKindOf: Class) ifTrue: [
|
|
1268 |
self error: 'class in assn'].
|
|
1269 |
sub value class == Symbol ifTrue: [sub value asciiValue = 204 '$Ì' ifTrue: [
|
|
1270 |
self error: 'Write into char']].
|
|
1271 |
sub value == $Ì ifTrue: [
|
|
1272 |
self error: 'Write into char']
|
|
1273 |
"].
|
|
1274 |
sub class == Array ifTrue: [
|
|
1275 |
sub do: [:element |
|
|
1276 |
element class == String ifTrue: [element first asciiValue < 32 ifTrue: [
|
|
1277 |
self error: 'store into string in data']].
|
|
1278 |
element class == Association ifTrue: [
|
|
1279 |
element value class == Association ifTrue: [
|
|
1280 |
self error: 'bad assn']]]].
|
|
1281 |
sub class == Date ifTrue: [sub year isInteger ifFalse: [
|
|
1282 |
self error: 'stored into input date!!!!']].
|
|
1283 |
sub class == Dictionary ifTrue: [
|
|
1284 |
sub size > 0 ifTrue: [
|
|
1285 |
self error: 'store into dictionary']].
|
|
1286 |
sub class == OrderedCollection ifTrue: [
|
|
1287 |
sub size > 4 ifTrue: [
|
|
1288 |
self error: 'store into OC']].
|
|
1289 |
].
|
1089
|
1290 |
!
|
|
1291 |
|
|
1292 |
test3
|
1104
|
1293 |
"find the modification of the caracter table"
|
1089
|
1294 |
|
1104
|
1295 |
(#x at: 1) asciiValue = 120 ifFalse: [self error: 'Character table mod'].
|
1089
|
1296 |
! !
|
|
1297 |
|
|
1298 |
!MethodFinder methodsFor:'search'!
|
|
1299 |
|
|
1300 |
exceptions
|
1104
|
1301 |
"Handle some very slippery selectors.
|
|
1302 |
asSymbol -- want to be able to produce it, but do not want to make every string submitted into a Symbol!!"
|
1089
|
1303 |
|
1104
|
1304 |
| aSel |
|
|
1305 |
answers first class == Symbol ifFalse: [^ self].
|
|
1306 |
thisData first first class == String ifFalse: [^ self].
|
|
1307 |
aSel _ #asSymbol.
|
|
1308 |
(self testPerfect: aSel) ifTrue: [
|
|
1309 |
selector add: aSel.
|
|
1310 |
expressions add: (String streamContents: [:strm |
|
|
1311 |
strm nextPutAll: 'data', argMap first printString.
|
|
1312 |
aSel keywords doWithIndex: [:key :ind |
|
|
1313 |
strm nextPutAll: ' ',key.
|
|
1314 |
(key last == $:) | (key first isLetter not)
|
|
1315 |
ifTrue: [strm nextPutAll: ' data',
|
|
1316 |
(argMap at: ind+1) printString]]])].
|
1089
|
1317 |
!
|
|
1318 |
|
|
1319 |
findMessage
|
|
1320 |
"Control the search."
|
|
1321 |
|
|
1322 |
data do: [:alist |
|
|
1323 |
(alist isKindOf: SequenceableCollection) ifFalse: [
|
|
1324 |
^ OrderedCollection with: 'first and third items are not Arrays']].
|
|
1325 |
|
1491
|
1326 |
true "Approved isNil" ifTrue: [self initialize]. "Sets of allowed selectors"
|
1089
|
1327 |
expressions _ OrderedCollection new.
|
|
1328 |
self search: true. "multi"
|
|
1329 |
expressions isEmpty ifTrue: [^ OrderedCollection with: 'no single method does that function'].
|
|
1330 |
expressions class = String ifTrue: [^ OrderedCollection with: expressions].
|
|
1331 |
^ expressions
|
|
1332 |
!
|
|
1333 |
|
|
1334 |
insertConstants
|
1104
|
1335 |
"see if one of several known expressions will do it. C is the constant we discover here."
|
|
1336 |
"C data1+C data1*C data1//C (data1*C1 + C2) (data1 = C) (data1 ~= C) (data1 <= C) (data1 >= C)
|
1089
|
1337 |
(data1 mod C)"
|
|
1338 |
|
1104
|
1339 |
thisData size >= 2 ifFalse: [^ self]. "need 2 examples"
|
|
1340 |
(thisData at: 1) size = 1 ifFalse: [^ self]. "only one arg, data1"
|
1089
|
1341 |
|
1104
|
1342 |
self const ifTrue: [^ self].
|
1491
|
1343 |
"/ self constEquiv ifTrue: [^ self]. " == ~= "
|
1104
|
1344 |
self constLessThan ifTrue: [^ self]. " <= and >= "
|
1089
|
1345 |
|
1104
|
1346 |
self allNumbers ifFalse: [^ self].
|
|
1347 |
self constMod ifTrue: [^ self].
|
|
1348 |
self constPlus ifTrue: [^ self].
|
|
1349 |
self constMult ifTrue: [^ self].
|
|
1350 |
self constDiv ifTrue: [^ self].
|
|
1351 |
self constLinear ifTrue: [^ self].
|
1089
|
1352 |
!
|
|
1353 |
|
|
1354 |
search: multi
|
|
1355 |
"if Multi is true, collect all selectors that work."
|
|
1356 |
| old |
|
|
1357 |
selector:=OrderedCollection new. "list of them"
|
|
1358 |
|
|
1359 |
" old _ Preferences autoAccessors.
|
|
1360 |
Preferences disableGently: #autoAccessors. "
|
|
1361 |
Smalltalk isSmalltalkX ifTrue:[old:=false].
|
|
1362 |
|
|
1363 |
self simpleSearch.
|
|
1364 |
multi not & (selector isEmpty not) ifTrue:
|
|
1365 |
["old ifTrue: [Preferences enableGently: #autoAccessors]."
|
|
1366 |
^ selector].
|
|
1367 |
|
|
1368 |
[self permuteArgs] whileTrue:
|
|
1369 |
[self simpleSearch.
|
|
1370 |
multi not & (selector isEmpty not) ifTrue:
|
|
1371 |
["old ifTrue: [Preferences enableGently: #autoAccessors]."
|
|
1372 |
^ selector]].
|
|
1373 |
|
|
1374 |
self insertConstants.
|
|
1375 |
" old ifTrue: [Preferences enableGently: #autoAccessors]. "
|
1491
|
1376 |
|
1089
|
1377 |
"/ (selector isEmpty not) ifTrue: [^ selector]]. " expression is the answer, not a selector"
|
|
1378 |
^ #()
|
|
1379 |
!
|
|
1380 |
|
|
1381 |
searchForOne
|
1104
|
1382 |
"Look for and return just one answer"
|
1089
|
1383 |
|
1104
|
1384 |
expressions _ OrderedCollection new.
|
|
1385 |
self search: false. "non-multi"
|
|
1386 |
^ expressions
|
|
1387 |
|
1089
|
1388 |
!
|
|
1389 |
|
|
1390 |
simpleSearch
|
|
1391 |
"Run through first arg's class' selectors, looking for one that works."
|
|
1392 |
|
|
1393 |
| class supers listOfLists |
|
|
1394 |
self exceptions.
|
|
1395 |
class:=thisData first first class.
|
|
1396 |
"Cache the selectors for the receiver class"
|
|
1397 |
(class == cachedClass and: [cachedArgNum = ((argMap size) - 1)])
|
|
1398 |
ifTrue: [listOfLists:=cachedSelectorLists]
|
|
1399 |
ifFalse: [supers:=class withAllSuperclasses.
|
|
1400 |
listOfLists:=OrderedCollection new.
|
1092
|
1401 |
supers do: [:cls |
|
1089
|
1402 |
listOfLists add: (cls selectorsWithArgs: (argMap size) - 1)].
|
|
1403 |
cachedClass:=class.
|
|
1404 |
cachedArgNum:=(argMap size) - 1.
|
|
1405 |
cachedSelectorLists:=listOfLists].
|
|
1406 |
"/ self halt.
|
|
1407 |
listOfLists do: [:selectorList |
|
|
1408 |
selectorList do: [:aSel |
|
|
1409 |
(selector includes: aSel) ifFalse: [
|
|
1410 |
((Approved includes: aSel) or: [AddAndRemove includes: aSel]) ifTrue: [
|
|
1411 |
(self testPerfect: aSel) ifTrue: [
|
|
1412 |
selector add: aSel.
|
|
1413 |
expressions add: (String streamContents: [:strm |
|
|
1414 |
strm nextPutAll: 'data', argMap first printString.
|
|
1415 |
aSel keywords doWithIndex: [:key :ind |
|
|
1416 |
strm nextPutAll: ' ',key.
|
|
1417 |
(key last == $:) | (key first isLetter not)
|
|
1418 |
ifTrue: [strm nextPutAll: ' data',
|
|
1419 |
(argMap at: ind+1) printString]]])
|
|
1420 |
]]]]].
|
|
1421 |
!
|
|
1422 |
|
|
1423 |
testPerfect: aSelector
|
|
1424 |
"Try this selector!! Return true if it answers every example perfectly. Take the args in the order they are. Do not permute them. Survive errors. later cache arg lists."
|
|
1425 |
|
|
1426 |
| sz argList val rec activeSel perform argIsBlock expectedAnswer|
|
|
1427 |
"Transcript cr; show: aSelector. debug"
|
|
1428 |
perform:=aSelector beginsWith: 'perform:'.
|
|
1429 |
sz:=argMap size.
|
|
1430 |
1 to: thisData size do: [:ii | "each example set of args"
|
|
1431 |
argList:=(thisData at: ii) copyFrom: 2 to: sz.
|
|
1432 |
perform
|
|
1433 |
ifFalse: [activeSel:=aSelector]
|
|
1434 |
ifTrue: [activeSel:=argList first. "what will be performed"
|
|
1435 |
((Approved includes: activeSel) or: [AddAndRemove includes: activeSel])
|
|
1436 |
ifFalse: [^ false]. "not approved"
|
|
1437 |
aSelector == #perform:withArguments:
|
|
1438 |
ifTrue: [activeSel numArgs = (argList at: 2) basicSize "avoid error"
|
|
1439 |
ifFalse: [^ false]]
|
|
1440 |
ifFalse: [activeSel numArgs = (aSelector numArgs - 1)
|
|
1441 |
ifFalse: [^ false]]].
|
|
1442 |
|
|
1443 |
|
|
1444 |
1 to: sz do: [:num |
|
|
1445 |
(Blocks includes: (Array with: activeSel with: num)) ifTrue: [
|
|
1446 |
Smalltalk isSmalltalkX ifTrue:[
|
|
1447 |
argIsBlock := (argList at: num) isBlock
|
|
1448 |
] ifFalse:[
|
|
1449 |
argIsBlock := (argList at: num) class == BlockContext
|
|
1450 |
].
|
1491
|
1451 |
argIsBlock ifFalse: [
|
|
1452 |
(BlocksOptional includes: (Array with: activeSel with: num)) ifFalse: [
|
|
1453 |
^ false
|
|
1454 |
]
|
|
1455 |
]]].
|
1089
|
1456 |
" (activeSel = #capitalized) ifTrue:[self halt.]. " " used to test "
|
|
1457 |
|
|
1458 |
rec:=(AddAndRemove includes: activeSel)
|
|
1459 |
ifTrue: [(thisData at: ii) first class == Symbol ifTrue: [^ false].
|
|
1460 |
"vulnerable to modification"
|
|
1461 |
(thisData at: ii) first copyTwoLevel] "protect from damage"
|
|
1462 |
ifFalse: [[(thisData at: ii) first]ifError:[self halt.]] .
|
|
1463 |
|
|
1464 |
expectedAnswer := (answers at: ii).
|
|
1465 |
val:= [ rec copy perform: aSelector withArguments: argList]
|
|
1466 |
ifError: [:aSignal|
|
1109
|
1467 |
"/ Transcript showCR:aSignal description.
|
1089
|
1468 |
"self test3."
|
|
1469 |
"self test2: (thisData at: ii)."
|
|
1470 |
^ false].
|
|
1471 |
"self test3."
|
|
1472 |
"self test2: (thisData at: ii)."
|
|
1473 |
(expectedAnswer isKindOf: Number)
|
|
1474 |
ifFalse:[
|
1109
|
1475 |
([ (expectedAnswer = val) ] ifError:[ false]) ifFalse: [^ false]]
|
1089
|
1476 |
ifTrue:[
|
|
1477 |
(expectedAnswer closeTo: val) ifFalse: [^ false]].
|
|
1478 |
].
|
|
1479 |
^ true
|
1109
|
1480 |
|
|
1481 |
"Modified: / 13.11.2001 / 19:08:39 / cg"
|
1089
|
1482 |
!
|
|
1483 |
|
|
1484 |
verify
|
|
1485 |
"Test a bunch of examples"
|
|
1486 |
" MethodFinder new verify "
|
1928
|
1487 |
Approved isNil ifTrue: [self initialize]. "Sets of allowed selectors"
|
1089
|
1488 |
"/(MethodFinder new load: #( (0) 0 (30) 0.5 (45) 0.707106 (90) 1)
|
|
1489 |
"/ ) searchForOne asArray = #('data1 degreeSin') ifFalse: [self error: 'should have found it']. "Squeak test"
|
1491
|
1490 |
(MethodFinder new load: (Array with:(Array with:true with:[3] with:[4]) with:3 with:(Array with:false with:[0] with:[6]) with:6)
|
|
1491 |
) searchForOne asArray = #('data1 ifTrue: data2 ifFalse: data3') ifFalse: [
|
|
1492 |
self error: 'should have found it'].
|
|
1493 |
(MethodFinder new load: #(#(1) true #(2) false #(5) true #(10) false)
|
|
1494 |
) searchForOne asArray = #('data1 odd' 'data1 isPrime') ifFalse: [self error: 'should have found it'].
|
1089
|
1495 |
"will correct the date type of #true, and complain"
|
|
1496 |
Smalltalk isSmalltalkX ifTrue:[
|
1491
|
1497 |
(MethodFinder new load: #((4 2) '2r100' (255 16) '16rFF' (14 8) '8r16')
|
1089
|
1498 |
) searchForOne asArray =
|
|
1499 |
#('data1 radixPrintStringRadix: data2' )
|
|
1500 |
ifFalse: [self error: 'should have found it'].
|
|
1501 |
] ifFalse:[
|
1491
|
1502 |
(MethodFinder new load: #((4 2) '2r100' (255 16) '16rFF' (14 8) '8r16')
|
1089
|
1503 |
) searchForOne asArray =
|
|
1504 |
#('data1 radix: data2' 'data1 printStringBase: data2' 'data1 storeStringBase: data2')
|
|
1505 |
ifFalse: [self error: 'should have found it'].
|
|
1506 |
].
|
|
1507 |
"/(MethodFinder2 new load: #(#(3@4) 4 #(1@5) 5)
|
|
1508 |
"/ ) searchForOne asArray = #('data1 y') ifFalse: [self error: 'should have found it'].
|
|
1509 |
Smalltalk isSmalltalkX ifTrue:[
|
1491
|
1510 |
(MethodFinder new load: #(('abcd') $a ('TedK') $T)
|
1089
|
1511 |
) searchForOne asArray = #('data1 first' 'data1 removeFirst' 'data1 anyOne')
|
|
1512 |
ifFalse: [self error: 'should have found it'].
|
|
1513 |
] ifFalse:[
|
1491
|
1514 |
(MethodFinder new load: #(('abcd') $a ('TedK') $T)
|
1089
|
1515 |
) searchForOne asArray = #('data1 asCharacter' 'data1 first' 'data1 anyOne')
|
|
1516 |
ifFalse: [self error: 'should have found it'].
|
|
1517 |
].
|
1491
|
1518 |
(((MethodFinder new load: #(('abcd' 1) $a ('Ted ' 3) $d )
|
1089
|
1519 |
) searchForOne asArray) includesAll: #('data1 at: data2' 'data1 atPin: data2' 'data1 atWrap: data2'))
|
|
1520 |
ifFalse: [self error: 'should have found it'].
|
1491
|
1521 |
(MethodFinder new load: #(((12 4 8)) 24 ((1 3 6)) 10 )
|
1089
|
1522 |
) searchForOne asArray= #('data1 sum') ifFalse: [self error: 'should have found it'].
|
|
1523 |
"note extra () needed for an Array object as an argument"
|
|
1524 |
|
1491
|
1525 |
(MethodFinder new load: #((14 3) 11 (-10 5) -15 (4 -3) 7)
|
1089
|
1526 |
) searchForOne asArray = #('data1 - data2') ifFalse: [self error: 'should have found it'].
|
1491
|
1527 |
((MethodFinder new load: #((4) 4 (-10) 10 (-3) 3 (2) 2 (-6) 6 (612) 612)
|
1089
|
1528 |
) searchForOne asArray includesAll: #('data1 abs')) ifFalse: [self error: 'should have found it'].
|
1491
|
1529 |
(MethodFinder new load: #(#(4 3) true #(-7 3) false #(5 1) true #(5 5) false)
|
1089
|
1530 |
) searchForOne asArray = #('data1 > data2') ifFalse: [self error: 'should have found it'].
|
1491
|
1531 |
(MethodFinder new load: #((5) 0.2 (2) 0.5)
|
1089
|
1532 |
) searchForOne asArray = #('data1 reciprocal') ifFalse: [self error: 'should have found it'].
|
1491
|
1533 |
(MethodFinder new load: #((12 4 8) 2 (1 3 6) 2 (5 2 16) 8)
|
1089
|
1534 |
) searchForOne asArray = #() " '(data3 / data2) ' want to be able to leave out args"
|
|
1535 |
ifFalse: [self error: 'should have found it'].
|
1491
|
1536 |
(MethodFinder new load: #((0.0) 0.0 (1.5) 0.997495 (0.75) 0.681639)
|
1089
|
1537 |
) searchForOne asArray = #('data1 sin') ifFalse: [self error: 'should have found it'].
|
1491
|
1538 |
(MethodFinder new load: #((7 5) 2 (4 5) 4 (-9 4) 3)
|
1089
|
1539 |
) searchForOne asArray = #('data1 \\ data2') ifFalse: [self error: 'should have found it'].
|
|
1540 |
! !
|
|
1541 |
|
|
1542 |
!MethodFinder class methodsFor:'documentation'!
|
|
1543 |
|
|
1544 |
version
|
1961
|
1545 |
^ '$Header: /cvs/stx/stx/libbasic3/MethodFinder.st,v 1.13 2007-03-22 10:28:33 cg Exp $'
|
1089
|
1546 |
! !
|