eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'MethodFinder':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: MethodFinder


Inheritance:

   Object
   |
   +--MethodFinder

Package:
stx:libbasic3
Category:
Interface-Tools
Version:
rev: 1.51 date: 2017/07/17 15:59:54
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.

Description:


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. 
                            


Class protocol:

accessing
o  abortAllSignal
return the value of the static variable 'AbortAllSignal' (automatically generated)

o  abortAllSignal: something
set the value of the static variable 'AbortAllSignal' (automatically generated)

o  addAndRemove
return the value of the static variable 'AddAndRemove' (automatically generated)

o  addAndRemove: something
set the value of the static variable 'AddAndRemove' (automatically generated)

o  approved
return the value of the static variable 'Approved' (automatically generated)

o  approved: something
set the value of the static variable 'Approved' (automatically generated)

o  blocks
return the value of the static variable 'Blocks' (automatically generated)

o  blocks: something
set the value of the static variable 'Blocks' (automatically generated)

o  dangerous
return the value of the static variable 'Dangerous' (automatically generated)

o  dangerous: something
set the value of the static variable 'Dangerous' (automatically generated)

utilities
o  methodFor: dataAndAnswers
Return a Smalltalk expression that computes these answers.


Instance protocol:

accessing
o  answers

o  data

o  expressions

o  selectors
Note the inst var does not have an S on the end

arg maps
o  argMap

o  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.

o  mapData
Force the data through the map (permutation) to create the data to test.

o  permuteArgs
Run through ALL the permutations. First one was as presented.

o  thisData

find a constant
o  allNumbers
Return true if all answers and all data are numbers.

o  const
See if (^ constant) is the answer

o  constDiv
See if (data1 // C) is the answer

o  constLessThan
See if (data1 <= C) or (data1 >= C) is the answer

o  constLinear
See if (data1 * C1) + C2 is the answer. In the form #(C2 C1) polynomialEval: data1

o  constMod
See if mod, (data1 \\ C) is the answer

o  constMult
See if (data1 * C) is the answer

o  constPlus
See if (data1 + C) is the answer

initialization
o  cleanInputs: dataAndAnswerString
Find and remove common mistakes. Complain when ill formed.

o  initialize
The methods we are allowed to use. (MethodFinder new initialize)
usage example(s):
initialize-release
usage example(s):
initialize-release
usage example(s):
initialize-release
usage example(s):
initialize-release
usage example(s):
initialize-release
usage example(s):
MethodFinder new initialize.
MethodFinder new organizationFiltered: Set

o  initialize2
The methods we are allowed to use. (MethodFinder new initialize)

o  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

o  noteDangerous
Remember the methods with really bad side effects.

o  organizationFiltered: aClass
Return the organization of the class with all selectors defined in superclasses removed. (except those in Object)

o  test2: anArray
look for bad association

o  test3
find the modification of the caracter table

search
o  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!

o  findMessage
Control the search.

o  insertConstants
see if one of several known expressions will do it. C is the constant we discover here.

o  search: multi
if Multi is true, collect all selectors that work.

o  searchForOne
Look for and return just one answer

o  simpleSearch
Run through first arg's class' selectors, looking for one that works.

o  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
o  verify
Test a bunch of examples
usage example(s):
MethodFinder new verify    



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Sun, 22 Jul 2018 16:49:49 GMT