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, java.io.Serializable
public class Add
- extends NaryBinaryFunction
- implements RealBinaryFunction
Addition function. Supports any number of parameters although typically
only 2 parameters are used.
- Author:
- nathan
- See Also:
- Serialized Form
Constructor Summary |
Add()
|
Method Summary |
static Complex |
add(Complex c1,
Complex c2)
|
static Complex |
add(Complex c,
java.lang.Number d)
|
static java.lang.Double |
add(java.lang.Number d1,
java.lang.Number d2)
|
java.lang.Object |
add(java.lang.Object param1,
java.lang.Object param2)
Adds two numbers together. |
java.util.Vector<java.lang.Object> |
add(java.util.Vector<?> v1,
java.util.Vector<?> v2)
|
java.lang.Object |
eval(java.lang.Object l,
java.lang.Object r)
|
double |
evaluate(double l,
double r)
|
Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand |
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, checkStack, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Add
public Add()
eval
public java.lang.Object eval(java.lang.Object l,
java.lang.Object r)
throws EvaluationException
- Specified by:
eval
in class NaryBinaryFunction
- Throws:
EvaluationException
add
public java.lang.Object add(java.lang.Object param1,
java.lang.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
add
public static java.lang.Double add(java.lang.Number d1,
java.lang.Number d2)
add
public static Complex add(Complex c1,
Complex c2)
add
public java.util.Vector<java.lang.Object> add(java.util.Vector<?> v1,
java.util.Vector<?> v2)
throws EvaluationException
- Throws:
EvaluationException
add
public static Complex add(Complex c,
java.lang.Number d)
evaluate
public double evaluate(double l,
double r)
- Specified by:
evaluate
in interface RealBinaryFunction
Copyright © 2010 Singular Systems http://www.singularsys.com/jep