42 |
42 |
43 The usage is the following. |
43 The usage is the following. |
44 |
44 |
45 We have to define a class, let's call it named_fn. Let us assume that |
45 We have to define a class, let's call it named_fn. Let us assume that |
46 we would like to use a parameter, called X. In the named_fn class we |
46 we would like to use a parameter, called X. In the named_fn class we |
47 have to define an _X attribute, and an X function. The function |
47 have to define an _X attribute, and a function X. The function |
48 expects a parameter with the type of _X, and sets the value of |
48 expects a parameter with the type of _X, and sets the value of |
49 _X. After setting the value the function returns the class itself. The |
49 _X. After setting the value the function returns the class itself. The |
50 class also have to have a function, called for example run(), we have |
50 class also have to have a function, called for example run(), we have |
51 to implement here the original function itself. The constructor of the |
51 to implement here the original function itself. The constructor of the |
52 class have to give all the attributes like _X the default values of |
52 class have to give all the attributes like _X the default values of |
53 them. |
53 them. |
54 |
54 |
55 If we instantiate this class, the default values will be set for the |
55 If we instantiate this class, the default values will be set for the |
56 attributes (originally the parameters), initially. If we call the X |
56 attributes (originally the parameters), initially. If we call function |
57 function, we get a class with the modified parameter value of |
57 X, we get a class with the modified parameter value of |
58 X. Therefore we can modify any parameter-value, independent from the |
58 X. Therefore we can modify any parameter-value, independent from the |
59 order. To run the algorithm we have to call the run() function at the |
59 order. To run the algorithm we have to call the run() function at the |
60 end of the row. |
60 end of the row. |
61 |
61 |
62 Example: named_fn().id(3).val(2).run(); |
62 Example: named_fn().id(3).val(2).run(); |