Package com.singularsys.jep.functions

# Class Add

java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.functions.NaryBinaryFunction
com.singularsys.jep.functions.Add

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

Direct Known Subclasses:
  `BigDecAdd`

public class Add extends NaryBinaryFunction implements RealBinaryFunction
Addition function. Supports any number of parameters although typically only 2 parameters are used.

Since:
  Jep 4.1 can work with `List<?>`.
Author:
  nathan
See Also:
  - Serialized Form

- ## Field Summary

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

  `curNumberOfParameters, description, name, NaN, numberOfParameters`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Add()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Complex`
  `add(Complex c1, Complex c2)`
  `static Complex`
  `add(Complex c, Number d)`
  `static Double`
  `add(Number d1, Number d2)`
  `Object`
  `add(Object param1, Object param2)`
  Adds two numbers together.
  `Vector<Object>`
  `add(List<?> v1, List<?> v2)`
  `Object`
  `eval(Object l, Object r)`
  Evaluate given a pair of arguments.
  `double`
  `evaluate(double l, double r)`

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

  `checkNumberOfParameters, eval, instanceOf, instanceOf, instanceOf, instanceOf, run`

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

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

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

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

- ## Constructor Details

  - ### Add

    public Add()

- ## Method Details

  - ### eval

    public Object eval(Object l, Object r) throws EvaluationException
    Description copied from class: `NaryBinaryFunction`
    Evaluate given a pair of arguments. Must be specified for all implementing classes.
    Specified by:
      `eval` in class `NaryBinaryFunction`
    Parameters:
      `l` - lhs argument
      `r` - rhs argument
    Returns:
      result of applying the function to the arguments
    Throws:
      `EvaluationException` - on error.

  - ### add

    public Object add(Object param1, Object param2) throws EvaluationException
    Adds two numbers together. The parameters can be of type Number, Complex, or String. If a certain combination of types is not supported, a EvaluationException is thrown.
    Parameters:
      `param1` - The first parameter to be added.
      `param2` - The second parameter to be added.
    Returns:
      The sum of param1 and param2, or concatenation of the two if they are Strings.
    Throws:
      `EvaluationException` - if the calculation cannot be performed

  - ### add

    public static Double add(Number d1, Number d2)

  - ### add

    public static Complex add(Complex c1, Complex c2)

  - ### add

    public Vector<Object> add(List<?> v1, List<?> v2) throws EvaluationException
    Throws:
      `EvaluationException`

  - ### add

    public static Complex add(Complex c, Number d)

  - ### evaluate

    public double evaluate(double l, double r)
    Specified by:
      `evaluate` in interface `RealBinaryFunction`