com.singularsys.jep.bigdecimal.functions
Class BigDecAdd
java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.functions.NaryBinaryFunction
com.singularsys.jep.bigdecimal.functions.BigDecAdd
- All Implemented Interfaces:
- PostfixMathCommandI, java.io.Serializable
public class BigDecAdd
- extends NaryBinaryFunction
Function class for the addition operator. It can operate on multiple
BigDecimals whose values are added or on Strings which are concatenated
together. Inheriting from NaryBinaryFunction creates a n-ary function which
is applied repeatedly if more than two arguments are provided.
- See Also:
- Serialized Form
Constructor Summary |
BigDecAdd(java.math.MathContext mc)
Constructor. |
Method Summary |
java.lang.Object |
eval(java.lang.Object l,
java.lang.Object r)
|
boolean |
getAllowStrings()
Whether adding strings is allowed. |
java.math.MathContext |
getMathContext()
|
void |
setAllowStrings(boolean allowStrings)
Sets whether strings should be allowed with this operator or not. |
void |
setMathContext(java.math.MathContext mc)
|
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 |
BigDecAdd
public BigDecAdd(java.math.MathContext mc)
- Constructor. Initialises the math context.
- Parameters:
mc
-
setMathContext
public void setMathContext(java.math.MathContext mc)
getMathContext
public java.math.MathContext getMathContext()
eval
public java.lang.Object eval(java.lang.Object l,
java.lang.Object r)
throws EvaluationException
- Specified by:
eval
in class NaryBinaryFunction
- Throws:
EvaluationException
getAllowStrings
public boolean getAllowStrings()
- Whether adding strings is allowed. (Treated as concatenation ).
- Returns:
- true if allowed
- Since:
- 3.4.0
setAllowStrings
public void setAllowStrings(boolean allowStrings)
- Sets whether strings should be allowed with this operator or not.
- Parameters:
allowStrings
- When true, strings are allowed. When false
an IllegalParameterException is thrown during evaluation.- Since:
- 3.4.0
Copyright © 2010 Singular Systems http://www.singularsys.com/jep