com.singularsys.jep.misc.nullwrapper.functions

## Class NullWrappedNaryBinary

- java.lang.Object
- - com.singularsys.jep.functions.PostfixMathCommand
  - - com.singularsys.jep.functions.NaryFunction
    - - com.singularsys.jep.misc.nullwrapper.functions.NullWrappedNaryBinary

- All Implemented Interfaces:
    NullWrappedFunctionI, PostfixMathCommandI, java.io.Serializable

      public class NullWrappedNaryBinary
      extends NaryFunction
      implements NullWrappedFunctionI

  Wrap a NaryBinaryFunction so that if any argument is null then null is returned.
  See Also:
    `NaryBinaryFunction`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand

      `curNumberOfParameters, name, NaN, numberOfParameters`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NullWrappedNaryBinary(NaryBinaryFunction fun)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `checkNumberOfParameters(int n)` Checks the number of parameters of the function.
    `java.lang.Object` | `eval(java.lang.Object[] args)` Evaluate the function
    `int` | `getNumberOfParameters()` Return the required number of parameters.
    `PostfixMathCommandI` | `getRoot()` Get to function which this function wraps.
    `void` | `setCurNumberOfParameters(int n)` Sets the number of current number of parameters used in the next call of run().
    `void` | `setName(java.lang.String name)` Sets the name of the function used for error messages

    - ### Methods inherited from class com.singularsys.jep.functions.NaryFunction

      `run`

    - ### Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand

      `asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, getName, toString, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### NullWrappedNaryBinary

          public NullWrappedNaryBinary(NaryBinaryFunction fun)

      Parameters:
        `fun` - the function to be wrapped

  - ### Method Detail

    - #### eval

          public java.lang.Object eval(java.lang.Object[] args)
                                throws EvaluationException

      Description copied from class: `NaryFunction`
      Evaluate the function
      Specified by:
        `eval` in class `NaryFunction`
      Parameters:
        `args` - arguments to the function
      Returns:
        value returned by the function
      Throws:
        `EvaluationException` - if the calculation cannot be performed

    - #### setName

          public void setName(java.lang.String name)

      Description copied from interface: `PostfixMathCommandI`
      Sets the name of the function used for error messages
      Specified by:
        `setName` in interface `PostfixMathCommandI`
      Overrides:
        `setName` in class `PostfixMathCommand`
      Parameters:
        `name` - the function name

    - #### getRoot

          public PostfixMathCommandI getRoot()

      Description copied from interface: `NullWrappedFunctionI`
      Get to function which this function wraps.
      Specified by:
        `getRoot` in interface `NullWrappedFunctionI`
      Returns:
        the root function, may be "this".

    - #### checkNumberOfParameters

          public boolean checkNumberOfParameters(int n)

      Description copied from class: `PostfixMathCommand`
      Checks the number of parameters of the function. Functions which set numberOfParameter=-1 should overload this method
      Specified by:
        `checkNumberOfParameters` in interface `PostfixMathCommandI`
      Overrides:
        `checkNumberOfParameters` in class `PostfixMathCommand`
      Parameters:
        `n` - number of parameters function will be called with.
      Returns:
        false if an illegal number of parameters is supplied, true otherwise.

    - #### getNumberOfParameters

          public int getNumberOfParameters()

      Description copied from class: `PostfixMathCommand`
      Return the required number of parameters.
      Specified by:
        `getNumberOfParameters` in interface `PostfixMathCommandI`
      Overrides:
        `getNumberOfParameters` in class `PostfixMathCommand`
      Returns:
        allowable number of parameters, -1 if a variable number is allowed

    - #### setCurNumberOfParameters

          public void setCurNumberOfParameters(int n)

      Description copied from class: `PostfixMathCommand`
      Sets the number of current number of parameters used in the next call of run(). This method is only called when the reqNumberOfParameters is -1.
      Specified by:
        `setCurNumberOfParameters` in interface `PostfixMathCommandI`
      Overrides:
        `setCurNumberOfParameters` in class `PostfixMathCommand`
      Parameters:
        `n` - number of parameter for next call of function

Copyright © 2018 Singular Systems http://www.singularsys.com/jep