|
Class: MethodFinder
Object
|
+--MethodFinder
- Package:
- stx:libbasic3
- Category:
- Interface-Tools
- Version:
- rev:
1.58
date: 2019/07/30 09:49:20
- user: cg
- file: MethodFinder.st directory: libbasic3
- module: stx stc-classLibrary: libbasic3
- Author:
- original squeak version by Ted Kaehler, Scott Wallace and Dan Ingalls.
- ported from Squeak and GUI enhanced 2001 by James Hayes james@exept.de.
- improved by Claus Gittinger.
a utility to find implementing methods by example.
Give it values for a receiver, optional arguments and a desired result,
and it will find methods which do that for you.
Please read the online documentation for details,
or open the MethodFinderView GUI.
[example:]
which message, answers 7, given to 4 with an argument of 3,
and also answers 5, if sent with an arg of 5 to 0
and 10, if send to 5 with an argument of 5:
MethodFinder methodFor: #(
(4 3) 7
(0 5) 5
(5 5) 10
)
You guessed it; it's the '+' message.
accessing
-
abortAllSignal
-
return the value of the static variable 'AbortAllSignal' (automatically generated)
-
abortAllSignal: something
-
set the value of the static variable 'AbortAllSignal' (automatically generated)
-
addAndRemove
-
return the value of the static variable 'AddAndRemove' (automatically generated)
-
addAndRemove: something
-
set the value of the static variable 'AddAndRemove' (automatically generated)
-
approved
-
return the value of the static variable 'Approved' (automatically generated)
-
approved: something
-
set the value of the static variable 'Approved' (automatically generated)
-
blocks
-
return the value of the static variable 'Blocks' (automatically generated)
-
blocks: something
-
set the value of the static variable 'Blocks' (automatically generated)
-
dangerous
-
return the value of the static variable 'Dangerous' (automatically generated)
-
dangerous: something
-
set the value of the static variable 'Dangerous' (automatically generated)
utilities
-
methodFor: dataAndAnswers
-
Return a Smalltalk expression that computes these answers.
accessing
-
answers
-
-
data
-
-
expressions
-
-
selectors
-
Note the inst var does not have an S on the end
arg maps
-
argMap
-
-
makeAllMaps
-
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.
-
mapData
-
Force the data through the map (permutation) to create the data to test.
-
permuteArgs
-
Run through ALL the permutations. First one was as presented.
-
thisData
-
find a constant
-
allNumbers
-
Return true if all answers and all data are numbers.
-
const
-
See if (^ constant) is the answer
-
constDiv
-
See if (data1 // C) is the answer
-
constLessThan
-
See if (data1 <= C) or (data1 >= C) is the answer
-
constLinear
-
See if (data1 * C1) + C2 is the answer. In the form #(C2 C1) polynomialEval: data1
-
constMod
-
See if mod, (data1 \\ C) is the answer
-
constMult
-
See if (data1 * C) is the answer
-
constPlus
-
See if (data1 + C) is the answer
initialization
-
cleanInputs: dataAndAnswerString
-
Find and remove common mistakes. Complain when ill formed.
-
initialize
-
The methods we are allowed to use. (MethodFinder new initialize)
usage example(s):
usage example(s):
usage example(s):
usage example(s):
usage example(s):
usage example(s):
MethodFinder new initialize.
MethodFinder new organizationFiltered: Set
|
-
initialize2
-
Additional methods we are allowed to use.
(invoked by MethodFinder new initialize)
-
load: dataWithAnswers
-
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.
usage example(s):
(MethodFinder new) load: #( (4 3) 7 (-10 5) -5 (-3 11) 8);
findMessage
|
-
noteDangerous
-
Remember the methods with really bad side effects.
-
organizationFiltered: aClass
-
Return the organization of the class with all selectors defined in superclasses removed. (except those in Object)
-
test2: anArray
-
look for bad association
-
test3
-
find the modification of the caracter table
search
-
exceptions
-
Handle some very slippery selectors.
asSymbol -- want to be able to produce it, but do not want to make every string submitted into a Symbol!
-
findMessage
-
Control the search.
-
insertConstants
-
see if one of several known expressions will do it.
C is the constant we discover here.
Needs 2 examples
-
search: multi
-
if Multi is true, collect all selectors that work.
-
searchForOne
-
Look for and return just one answer
-
simpleSearch
-
Run through first arg's class' selectors, looking for one that works.
-
testPerfect: aSelector
-
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.
tests
-
verify
-
Test a bunch of examples
usage example(s):
|