Class BigDecTieBreakComparative
java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.functions.BinaryFunction
com.singularsys.jep.functions.Comparative
com.singularsys.jep.bigdecimal.functions.BigDecRelational
com.singularsys.jep.bigdecimal.functions.BigDecTieBreakComparative
- All Implemented Interfaces:
PostfixMathCommandI,Serializable
A version of the comparative operator which breaks ties between two
BigDecimal numbers representing the same value with different precisions,
here for the LT operation 2.0 < 2.00 and for the GT operation
2.00 > 2.0.
Its intended this function would be used with the MinMax function and ensures
consistency so min(2.0,2.00)==2.0 and
min(2.00,2.0)==2.0 irrespective of the order.
To use
jep.addFunction("min",new MinMax(new BigDecTieBreakComparative(BigDecRelational.LT)));
jep.addFunction("max",new MinMax(new BigDecTieBreakComparative(BigDecRelational.GT)));
- See Also:
-
Field Summary
Fields inherited from class com.singularsys.jep.bigdecimal.functions.BigDecRelational
idFields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, name, NaN, numberOfParameters -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.singularsys.jep.bigdecimal.functions.BigDecRelational
eval, getAllowStrings, setAllowStringsMethods inherited from class com.singularsys.jep.functions.Comparative
eq, ge, getId, getTolerance, gt, le, lt, ne, setToleranceMethods inherited from class com.singularsys.jep.functions.BinaryFunction
instanceOf, instanceOf, runMethods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, checkNumberOfParameters, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString
-
Constructor Details
-
BigDecTieBreakComparative
public BigDecTieBreakComparative(int id) Constructor- Parameters:
id- must be either LT or GT- Throws:
IllegalArgumentException- if id is LE, GE, EQ or NE
-
-
Method Details
-
compare
- Overrides:
comparein classBigDecRelational- Throws:
EvaluationException
-