Class Expression.Comparator

    • Constructor Summary

      Constructors 
      Constructor Description
      Comparator​(java.lang.String oper, int precedence)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract boolean compare​(java.lang.Comparable v1, java.lang.Comparable v2)
      This method actually implements the comparison.
      java.lang.Object eval​(java.lang.String v1, java.lang.String v2)  
      java.math.BigDecimal eval​(java.math.BigDecimal v1, java.math.BigDecimal v2)
      Implementation for this operator.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Comparator

        public Comparator​(java.lang.String oper,
                          int precedence)
    • Method Detail

      • eval

        public java.math.BigDecimal eval​(java.math.BigDecimal v1,
                                         java.math.BigDecimal v2)
        Description copied from class: Expression.Operator
        Implementation for this operator.
        Specified by:
        eval in class Expression.Operator
        Parameters:
        v1 - Operand 1.
        v2 - Operand 2.
        Returns:
        The result of the operation.
      • eval

        public java.lang.Object eval​(java.lang.String v1,
                                     java.lang.String v2)
        Overrides:
        eval in class Expression.Operator
      • compare

        public abstract boolean compare​(java.lang.Comparable v1,
                                        java.lang.Comparable v2)
        This method actually implements the comparison. It will be called with either 2 BigIntegers or 2 Strings.
        Parameters:
        v1 - Operand 1.
        v2 - Operand 2.
        Returns:
        The result of the comparison.