Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ec.cgp.functions
Class FunctionsRegression

    java.lang.Object
      ec.cgp.functions.FunctionsRegression

All Implemented Interfaces:
  Functions

    public class FunctionsRegression

extends java.lang.Object
implements Functions

Function set for the regression problems.

Author:
  David Oranchak, doranchak@gmail.com, http://oranchak.com

Field Summary
`(package private) static int` | `F_ADD` Add
`(package private) static int` | `F_DIV` Safe divide
`(package private) static int` | `F_MUL` Multiply
`(package private) static int` | `F_SUB` Subtract

Constructor Summary
`FunctionsRegression()`

Method Summary
`int` | `arityOf(int fn)` Return the arity of the given function
`java.lang.Object` | `callFunction(java.lang.Object[] inputs, int function, int numFunctions)` Interpret the given function and apply it to the given inputs.
`java.lang.String` | `functionName(int fn)` Return a function name, suitable for display in expressions, for the given function.
`java.lang.String` | `inputName(int inp, java.lang.Object val)` Return the name, suitable for display, for the given input.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### F_ADD

    static int F_ADD

  Add

### F_SUB

    static int F_SUB

  Subtract

### F_MUL

    static int F_MUL

  Multiply

### F_DIV

    static int F_DIV

  Safe divide

Constructor Detail

### FunctionsRegression

    public FunctionsRegression()

Method Detail

### callFunction

    public java.lang.Object callFunction(java.lang.Object[] inputs,
                                         int function,
                                         int numFunctions)

  Interpret the given function and apply it to the given inputs.

  Specified by:
    `callFunction` in interface `Functions`
  Parameters:
    `inputs` - The arguments passed to the function. It is possible that some or all of the arguments will be unused by some functions.
    `function` - The function number. Every function number must map to a function.
    `numFunctions` - The total number of functions available.
  Returns:
    the result of the function call

### functionName

    public java.lang.String functionName(int fn)

  Return a function name, suitable for display in expressions, for the given function.

  Specified by:
    `functionName` in interface `Functions`
  Parameters:
    `fn` - The function number
  Returns:
    The descriptive function name that corresponds to this function number.

### arityOf

    public int arityOf(int fn)

  Return the arity of the given function

  Specified by:
    `arityOf` in interface `Functions`
  Parameters:
    `fn` - the function number
  Returns:
    The number of inputs this function expects.

### inputName

    public java.lang.String inputName(int inp,
                                      java.lang.Object val)

  Return the name, suitable for display, for the given input.

  Specified by:
    `inputName` in interface `Functions`
  Parameters:
    `inp` - The input number
    `val` - Optional input value (needed if you want to display a constant value for this input)
  Returns:
    The descriptive input name that corresponds to this input.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD