Class 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:
  • 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