Package com.singularsys.jep.bigdecimal.functions

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

public class BigDecRelational extends Comparative
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:
  - Serialized Form

- ## Nested Class Summary

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

  `BinaryFunction.BiFunctionWithException<T>`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final int`
  `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
  `BigDecRelational(int id_in)`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `cmpVec(List<?> v1, List<?> v2)`
  `boolean`
  `compare(Object l, Object r)`
  Compares the two arguments.
  `Object`
  `eval(Object l, Object r)`
  Evaluate the function
  `boolean`
  `getAllowStrings()`
  Whether comparing strings is allowed.
  `String`
  `getDescription()`
  Return a description of the function from the properties file.
  `void`
  `setAllowStrings(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, 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`

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

    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 `Comparative`
    Parameters:
      `l` -
      `r` -
    Returns:
    Throws:
      `EvaluationException`

  - ### cmpVec

    public boolean cmpVec(List<?> v1, List<?> v2) throws EvaluationException
    Throws:
      `EvaluationException`

  - ### eval

    public Object eval(Object l, Object r) throws EvaluationException
    Description copied from class: `BinaryFunction`
    Evaluate the function
    Overrides:
      `eval` in class `Comparative`
    Parameters:
      `l` - lhs argument
      `r` - 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

    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 `Comparative`
    Returns:
      the description of the function