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

- - ### 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, name, NaN, numberOfParameters`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BigDecTieBreakComparative(int id)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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

      `run`

    - ### Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand

      `asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, checkNumberOfParameters, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString`

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

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

- - ### Constructor Detail

    - #### BigDecTieBreakComparative

          public BigDecTieBreakComparative(int id)

      Constructor
      Parameters:
        `id` - must be either LT or GT
      Throws:
        `java.lang.IllegalArgumentException` - if id is LE, GE, EQ or NE

  - ### Method Detail

    - #### compare

          public boolean compare(java.lang.Object l,
                                 java.lang.Object r)
                          throws EvaluationException

      Overrides:
        `compare` in class `BigDecRelational`
      Throws:
        `EvaluationException`

Copyright © 2018 Singular Systems http://www.singularsys.com/jep