Class NumberCompare

  • All Implemented Interfaces:
    Named

    public class NumberCompare
    extends ProcedureN
    This implements the numeric comparison relations: <, <=, etc.
    • Constructor Detail

      • NumberCompare

        public NumberCompare()
    • Method Detail

      • numArgs

        public int numArgs()
        Description copied from class: Procedure
        Return minArgs()|(maxArgs<<12). We use a single virtual function to reduce the number of methods in the system, as well as the number of virtual method table entries. We shift by 12 so the number can normally be represented using a sipush instruction, without requiring a constant pool entry.
        Overrides:
        numArgs in class Procedure
      • $Eq

        public static boolean $Eq​(Object arg1,
                                  Object arg2)
      • $Gr

        public static boolean $Gr​(Object arg1,
                                  Object arg2)
      • $Gr$Eq

        public static boolean $Gr$Eq​(Object arg1,
                                     Object arg2)
      • $Ls

        public static boolean $Ls​(Object arg1,
                                  Object arg2)
      • $Ls$Eq

        public static boolean $Ls$Eq​(Object arg1,
                                     Object arg2)
      • getLanguage

        protected final Language getLanguage()
      • apply2

        public static boolean apply2​(int flags,
                                     Object arg1,
                                     Object arg2)
      • checkCompareCode

        public static boolean checkCompareCode​(int code,
                                               int flags)
      • applyWithPromotion

        public static boolean applyWithPromotion​(int flags,
                                                 Object arg1,
                                                 Object arg2)
      • compare

        public static int compare​(Object arg1,
                                  Object arg2,
                                  boolean exact)
        Compare two numbers.
        Parameters:
        exact - true if we should compare exact/inexact numbers exactly (by converting the inexact number to exact), or inexactly (by "promoting" the exact to inexact) (as required for XQuery).
        Returns:
        1 if arg1>arg2; 0 if arg1==arg2; -1 if arg1<arg2; -2 if either is NaN; -3 if not comparable (either is not a number).
      • compareStrict

        public static int compareStrict​(Object arg1,
                                        Object arg2,
                                        boolean exact)
      • compare

        public static int compare​(Object arg1,
                                  int code1,
                                  Object arg2,
                                  int code2,
                                  boolean exact)