Class BigDecRelational
java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.functions.BinaryFunction
com.singularsys.jep.functions.Comparative
com.singularsys.jep.bigdecimal.functions.BigDecRelational
- All Implemented Interfaces:
PostfixMathCommandI,Serializable
- Direct Known Subclasses:
BigDecTieBreakComparative
Implements the relational operations <, >, <=, >=, != and ==.
BigDecimals can be compared to each other.
Boolean values can be compared to each other.
If the allowStrings option is set then Strings can be compared to each other.
An illegal parameter exception is thrown if BigDecimals and Booleans or BigDecimals and Strings or Booleans and Strings are compared.
- Version:
- 5.3 Now extends Comparative so can be used in MinMax
Since Jep 4.1 can work with vectors, for testing equality.
- Author:
- N Funk
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.singularsys.jep.functions.BinaryFunction
BinaryFunction.BiFunctionWithException<T> -
Field Summary
FieldsFields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, description, name, NaN, numberOfParameters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanCompares the two arguments.Evaluate the functionbooleanWhether comparing strings is allowed.Return a description of the function from the properties file.voidsetAllowStrings(boolean allowStrings) Sets whether comparing strings is allowed.Methods 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, instanceOf, instanceOf, runMethods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, asType, checkNumberOfParameters, getDescription, getDescriptionWithType, getName, getNumberOfParameters, setCurNumberOfParameters, setDescription, setName, toString, toString
-
Field Details
-
id
protected final int id
-
-
Constructor Details
-
BigDecRelational
public BigDecRelational(int id_in) Constructor. Sets the number of parameters to 2.- Parameters:
id_in- The id of the comparative operator.
-
-
Method Details
-
compare
Description copied from class:ComparativeCompares the two arguments. Result depend on which comparative option has been selected.- Overrides:
comparein classComparative- Parameters:
l-r-- Returns:
- Throws:
EvaluationException
-
cmpVec
- Throws:
EvaluationException
-
eval
Description copied from class:BinaryFunctionEvaluate the function- Overrides:
evalin classComparative- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the results
- Throws:
EvaluationException- if the function cannot be evaluated.
-
getAllowStrings
public boolean getAllowStrings()Whether comparing strings is allowed.- Returns:
- true if allowed
- Since:
- 3.4.0
-
setAllowStrings
public void setAllowStrings(boolean allowStrings) Sets whether comparing strings is allowed.- Parameters:
allowStrings- When true, strings are allowed. When false an IllegalParameterException is thrown during evaluation.- Since:
- 3.4.0
-
getDescription
Description copied from class:PostfixMathCommandReturn a description of the function from the properties file. The property name is the class name followed by ".description". The property is found using theJepMessagesclass, which can be configured to add additional properties files. IfPostfixMathCommand.setDescription(String)has been called, return the description set by that method instead.- Specified by:
getDescriptionin interfacePostfixMathCommandI- Overrides:
getDescriptionin classComparative- Returns:
- the description of the function
-