Package com.singularsys.jep.bigdecimal.functions

# 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`

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 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:
  - `MinMax`
  - Serialized Form

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class com.singularsys.jep.functions.BinaryFunction

  `BinaryFunction.BiFunctionWithException<T>`

- ## Field Summary

  ### Fields inherited from class com.singularsys.jep.bigdecimal.functions.BigDecRelational

  `id`

  ### Fields inherited from class com.singularsys.jep.functions.Comparative

  `EQ, GE, GT, LE, LT, NE`

  ### Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand

  `curNumberOfParameters, description, name, NaN, numberOfParameters`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BigDecTieBreakComparative(int id)`
  Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `compare(Object l, Object r)`
  Compares the two arguments.
  `String`
  `getDescription()`
  Return a description of the function from the properties file.

  ### Methods inherited from class com.singularsys.jep.bigdecimal.functions.BigDecRelational

  `cmpVec, 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, instanceOf, instanceOf, run`

  ### Methods 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`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## 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

    public boolean compare(Object l, Object r) throws EvaluationException
    Description copied from class: `Comparative`
    Compares the two arguments. Result depend on which comparative option has been selected.
    Overrides:
      `compare` in class `BigDecRelational`
    Parameters:
      `l` -
      `r` -
    Returns:
    Throws:
      `EvaluationException`

  - ### getDescription

    public String getDescription()
    Description copied from class: `PostfixMathCommand`
    Return a description of the function from the properties file. The property name is the class name followed by ".description". The property is found using the `JepMessages` class, which can be configured to add additional properties files. If `PostfixMathCommand.setDescription(String)` has been called, return the description set by that method instead.
    Specified by:
      `getDescription` in interface `PostfixMathCommandI`
    Overrides:
      `getDescription` in class `BigDecRelational`
    Returns:
      the description of the function