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
,java.io.Serializable
public class BigDecTieBreakComparative extends BigDecRelational
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 consistancy so
min(2.0,2.00)==2.0
andmin(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:
MinMax
, Serialized Form
-
-
Field Summary
-
Fields inherited from class com.singularsys.jep.bigdecimal.functions.BigDecRelational
id
-
Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, name, NaN, numberOfParameters
-
-
Constructor Summary
Constructors Constructor Description BigDecTieBreakComparative(int id)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
compare(java.lang.Object l, java.lang.Object r)
-
Methods inherited from class com.singularsys.jep.bigdecimal.functions.BigDecRelational
eval, getAllowStrings, setAllowStrings
-
Methods inherited from class com.singularsys.jep.functions.Comparative
eq, ge, getId, getTolerance, gt, le, lt, ne, setTolerance
-
Methods inherited from class com.singularsys.jep.functions.BinaryFunction
instanceOf, instanceOf, run
-
Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, checkNumberOfParameters, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString
-
-
-
-
Method Detail
-
compare
public boolean compare(java.lang.Object l, java.lang.Object r) throws EvaluationException
- Overrides:
compare
in classBigDecRelational
- Throws:
EvaluationException
-
-