Package com.singularsys.jep.misc.nullwrapper.functions

# Class NullWrappedPfmc

java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.misc.nullwrapper.functions.NullWrappedPfmc

All Implemented Interfaces:
  `NullWrappedFunctionI`, `PostfixMathCommandI`, `Serializable`

public class NullWrappedPfmc extends PostfixMathCommand implements NullWrappedFunctionI
Wrap a general PostfixMathCommand so that if any argument is null the function will return null.

Since:
  3.4
Author:
  Richard Morris
See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final PostfixMathCommand`
  `fun`

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

  `curNumberOfParameters, description, name, NaN, numberOfParameters`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NullWrappedPfmc(PostfixMathCommand fun)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `checkNumberOfParameters(int n)`
  Checks the number of parameters of the function.
  `String`
  `getDescription()`
  Return a description of the function from the properties file.
  `int`
  `getNumberOfParameters()`
  Return the required number of parameters.
  `PostfixMathCommandI`
  `getRoot()`
  Get to function which this function wraps.
  `void`
  `run(Stack<Object> stack)`
  Throws an exception because this method should never be called under normal circumstances.
  `void`
  `setCurNumberOfParameters(int n)`
  Sets the number of current number of parameters used in the next call of run().
  `void`
  `setName(String name)`
  Sets the name of the function used for error messages

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

  `asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, asType, getDescription, getDescriptionWithType, getName, setDescription, toString, toString`

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

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

- ## Field Details

  - ### fun

    protected final PostfixMathCommand fun

- ## Constructor Details

  - ### NullWrappedPfmc

    public NullWrappedPfmc(PostfixMathCommand fun)
    Parameters:
      `fun` -

- ## Method Details

  - ### 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

  - ### setName

    public void setName(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".

  - ### run

    public void run(Stack<Object> stack) throws EvaluationException
    Description copied from class: `PostfixMathCommand`
    Throws an exception because this method should never be called under normal circumstances. Each function should use its own `run()` method for evaluating the function. This includes popping off the parameters from the stack, and pushing the result back on the stack.
    Specified by:
      `run` in interface `PostfixMathCommandI`
    Overrides:
      `run` in class `PostfixMathCommand`
    Parameters:
      `stack` - arguments for function
    Throws:
      `EvaluationException` - if function cannot be evaluated

  - ### getDescription

    public String getDescription()
    Description copied from class: `PostfixMathCommand`
    Return a description of the function from the properties file. The property name is the class name followed by ".description". The property is found using the `JepMessages` class, which can be configured to add additional properties files. If `PostfixMathCommand.setDescription(String)` has been called, return the description set by that method instead.
    Specified by:
      `getDescription` in interface `PostfixMathCommandI`
    Overrides:
      `getDescription` in class `PostfixMathCommand`
    Returns:
      the description of the function