Class NumberCompare

All Implemented Interfaces:
Named

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

  • Constructor Details

    • NumberCompare

      public NumberCompare()
  • Method Details

    • 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)
    • $Eq$V

      public static boolean $Eq$V(Object arg1, Object arg2, Object arg3, Object[] rest)
    • $Gr$V

      public static boolean $Gr$V(Object arg1, Object arg2, Object arg3, Object[] rest)
    • $Gr$Eq$V

      public static boolean $Gr$Eq$V(Object arg1, Object arg2, Object arg3, Object[] rest)
    • $Ls$V

      public static boolean $Ls$V(Object arg1, Object arg2, Object arg3, Object[] rest)
    • $Ls$Eq$V

      public static boolean $Ls$Eq$V(Object arg1, Object arg2, Object arg3, Object[] rest)
    • make

      public static NumberCompare make(Language language, String name, int flags)
    • getLanguage

      protected final Language getLanguage()
    • apply2

      public Object apply2(Object arg1, Object arg2)
      Overrides:
      apply2 in class Procedure
    • 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)
    • applyN

      public Object applyN(Object[] args)
      Overrides:
      applyN in class Procedure