com.singularsys.jep.functions

## Class NullaryFunction

- java.lang.Object
- - com.singularsys.jep.functions.PostfixMathCommand
  - - com.singularsys.jep.functions.NullaryFunction

- All Implemented Interfaces:
    PostfixMathCommandI, java.io.Serializable
  Direct Known Subclasses:
    ConstantFunction, Random, ThreadSafeRandom

      public abstract class NullaryFunction
      extends PostfixMathCommand

  Convenient base class for zero-argument nullary functions, like `random()`. Defines an `Object eval()` method for calculating the result.
  Since:
    3.5
  See Also:
    Serialized Form

- - ### Field Summary

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

      `curNumberOfParameters, name, NaN, numberOfParameters`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NullaryFunction()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract java.lang.Object` | `eval()` Evaluate the function
    `void` | `run(java.util.Stack<java.lang.Object> stack)` Calls `eval()`

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

      `asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, checkNumberOfParameters, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString`

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

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

- - ### Constructor Detail

    - #### NullaryFunction

          public NullaryFunction()

  - ### Method Detail

    - #### run

          public void run(java.util.Stack<java.lang.Object> stack)
                   throws EvaluationException

      Calls `eval()`
      Specified by:
        `run` in interface `PostfixMathCommandI`
      Overrides:
        `run` in class `PostfixMathCommand`
      Parameters:
        `stack` - arguments for function
      Throws:
        `EvaluationException` - if function cannot be evaluated

    - #### eval

          public abstract java.lang.Object eval()
                                         throws EvaluationException

      Evaluate the function
      Returns:
        value of the function
      Throws:
        `EvaluationException`

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