gnu.kawa.functions
Class NumberCompare

java.lang.Object
  extended by gnu.mapping.PropertySet
      extended by gnu.mapping.Procedure
          extended by gnu.mapping.ProcedureN
              extended by gnu.kawa.functions.NumberCompare
All Implemented Interfaces:
CanInline, Inlineable, Named

public class NumberCompare
extends ProcedureN
implements CanInline, Inlineable

This implements the numeric comparison relations: <, <=, etc.


Field Summary
static int TRUE_IF_EQU
           
static int TRUE_IF_GRT
           
static int TRUE_IF_LSS
           
static int TRUE_IF_NAN
           
static int TRUE_IF_NEQ
           
 
Fields inherited from class gnu.mapping.ProcedureN
noArgs
 
Constructor Summary
NumberCompare()
           
 
Method Summary
static boolean $Eq(java.lang.Object arg1, java.lang.Object arg2)
           
static boolean $Eq$V(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object[] rest)
           
static boolean $Gr(java.lang.Object arg1, java.lang.Object arg2)
           
static boolean $Gr$Eq(java.lang.Object arg1, java.lang.Object arg2)
           
static boolean $Gr$Eq$V(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object[] rest)
           
static boolean $Gr$V(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object[] rest)
           
static boolean $Ls(java.lang.Object arg1, java.lang.Object arg2)
           
static boolean $Ls$Eq(java.lang.Object arg1, java.lang.Object arg2)
           
static boolean $Ls$Eq$V(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object[] rest)
           
static boolean $Ls$V(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object[] rest)
           
static boolean apply2(int flags, java.lang.Object arg1, java.lang.Object arg2)
           
 java.lang.Object apply2(java.lang.Object arg1, java.lang.Object arg2)
           
 java.lang.Object applyN(java.lang.Object[] args)
           
static boolean applyWithPromotion(int flags, java.lang.Object arg1, java.lang.Object arg2)
           
static boolean checkCompareCode(int code, int flags)
           
static int compare(java.lang.Object arg1, int code1, java.lang.Object arg2, int code2, boolean exact)
           
static int compare(java.lang.Object arg1, java.lang.Object arg2, boolean exact)
          Compare two numbers.
 void compile(ApplyExp exp, Compilation comp, Target target)
           
protected  Language getLanguage()
           
 Type getReturnType(Expression[] args)
           
 Expression inline(ApplyExp exp, ExpWalker walker)
          Inline an application of this Procedure and return result.
static NumberCompare make(Language language, java.lang.String name, int flags)
           
 int numArgs()
          Return minArgs()|(maxArgs<<12).
 
Methods inherited from class gnu.mapping.ProcedureN
apply0, apply1, apply3, apply4
 
Methods inherited from class gnu.mapping.Procedure
apply, apply, check0, check1, check2, check3, check4, checkArgCount, checkN, getSetter, getSourceLocation, match0, match1, match2, match3, match4, matchN, maxArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation, toString
 
Methods inherited from class gnu.mapping.PropertySet
getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TRUE_IF_GRT

public static final int TRUE_IF_GRT
See Also:
Constant Field Values

TRUE_IF_EQU

public static final int TRUE_IF_EQU
See Also:
Constant Field Values

TRUE_IF_LSS

public static final int TRUE_IF_LSS
See Also:
Constant Field Values

TRUE_IF_NAN

public static final int TRUE_IF_NAN
See Also:
Constant Field Values

TRUE_IF_NEQ

public static final int TRUE_IF_NEQ
See Also:
Constant Field Values
Constructor Detail

NumberCompare

public NumberCompare()
Method Detail

numArgs

public int numArgs()
Description copied from class: Procedure
Return minArgs()|(maxArgs<<12).

Overrides:
numArgs in class Procedure

$Eq

public static boolean $Eq(java.lang.Object arg1,
                          java.lang.Object arg2)

$Gr

public static boolean $Gr(java.lang.Object arg1,
                          java.lang.Object arg2)

$Gr$Eq

public static boolean $Gr$Eq(java.lang.Object arg1,
                             java.lang.Object arg2)

$Ls

public static boolean $Ls(java.lang.Object arg1,
                          java.lang.Object arg2)

$Ls$Eq

public static boolean $Ls$Eq(java.lang.Object arg1,
                             java.lang.Object arg2)

$Eq$V

public static boolean $Eq$V(java.lang.Object arg1,
                            java.lang.Object arg2,
                            java.lang.Object arg3,
                            java.lang.Object[] rest)

$Gr$V

public static boolean $Gr$V(java.lang.Object arg1,
                            java.lang.Object arg2,
                            java.lang.Object arg3,
                            java.lang.Object[] rest)

$Gr$Eq$V

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

$Ls$V

public static boolean $Ls$V(java.lang.Object arg1,
                            java.lang.Object arg2,
                            java.lang.Object arg3,
                            java.lang.Object[] rest)

$Ls$Eq$V

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

make

public static NumberCompare make(Language language,
                                 java.lang.String name,
                                 int flags)

getLanguage

protected final Language getLanguage()

apply2

public java.lang.Object apply2(java.lang.Object arg1,
                               java.lang.Object arg2)
Overrides:
apply2 in class ProcedureN

apply2

public static boolean apply2(int flags,
                             java.lang.Object arg1,
                             java.lang.Object arg2)

checkCompareCode

public static boolean checkCompareCode(int code,
                                       int flags)

applyWithPromotion

public static boolean applyWithPromotion(int flags,
                                         java.lang.Object arg1,
                                         java.lang.Object arg2)

compare

public static int compare(java.lang.Object arg1,
                          java.lang.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).

compare

public static int compare(java.lang.Object arg1,
                          int code1,
                          java.lang.Object arg2,
                          int code2,
                          boolean exact)

applyN

public java.lang.Object applyN(java.lang.Object[] args)
Specified by:
applyN in class ProcedureN

inline

public Expression inline(ApplyExp exp,
                         ExpWalker walker)
Description copied from interface: CanInline
Inline an application of this Procedure and return result. Can return original expression.

Specified by:
inline in interface CanInline

compile

public void compile(ApplyExp exp,
                    Compilation comp,
                    Target target)
Specified by:
compile in interface Inlineable

getReturnType

public Type getReturnType(Expression[] args)
Specified by:
getReturnType in interface Inlineable