gnu.kawa.functions

Class NumberCompare

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

Method Summary

static boolean
$Eq(Object arg1, Object arg2)
static boolean
$Eq$V(Object arg1, Object arg2, Object arg3, Object[] rest)
static boolean
$Gr(Object arg1, Object arg2)
static boolean
$Gr$Eq(Object arg1, Object arg2)
static boolean
$Gr$Eq$V(Object arg1, Object arg2, Object arg3, Object[] rest)
static boolean
$Gr$V(Object arg1, Object arg2, Object arg3, Object[] rest)
static boolean
$Ls(Object arg1, Object arg2)
static boolean
$Ls$Eq(Object arg1, Object arg2)
static boolean
$Ls$Eq$V(Object arg1, Object arg2, Object arg3, Object[] rest)
static boolean
$Ls$V(Object arg1, Object arg2, Object arg3, Object[] rest)
Object
apply2(Object arg1, Object arg2)
static boolean
apply2(int flags, Object arg1, Object arg2)
Object
applyN(Object[] args)
static boolean
applyWithPromotion(int flags, Object arg1, Object arg2)
static boolean
checkCompareCode(int code, int flags)
static int
compare(Object arg1, Object arg2, boolean exact)
Compare two numbers.
static int
compare(Object arg1, int code1, Object arg2, int code2, boolean exact)
void
compile(ApplyExp exp, Compilation comp, Target target)
protected Language
getLanguage()
Type
getReturnType(Expression[] args)
Expression
inline(ApplyExp exp, ExpWalker walker)
static NumberCompare
make(Language language, String name, int flags)
int
numArgs()

Methods inherited from class gnu.mapping.ProcedureN

apply0, apply1, apply2, apply3, apply4, applyN

Methods inherited from class gnu.mapping.Procedure

apply, apply, apply0, apply1, apply2, apply3, apply4, applyN, check0, check1, check2, check3, check4, checkArgCount, checkN, getSetter, getSourceLocation, match0, match1, match2, match3, match4, matchN, maxArgs, minArgs, numArgs, set0, set1, setN, setSetter, setSourceLocation, toString

Methods inherited from class gnu.mapping.PropertySet

getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol

Field Details

TRUE_IF_EQU

public static final int TRUE_IF_EQU
Field Value:
8

TRUE_IF_GRT

public static final int TRUE_IF_GRT
Field Value:
16

TRUE_IF_LSS

public static final int TRUE_IF_LSS
Field Value:
4

TRUE_IF_NAN

public static final int TRUE_IF_NAN
Field Value:
2

TRUE_IF_NEQ

public static final int TRUE_IF_NEQ
Field Value:
1

Method Details

$Eq

public static boolean $Eq(Object arg1,
                          Object arg2)

$Eq$V

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

$Gr

public static boolean $Gr(Object arg1,
                          Object arg2)

$Gr$Eq

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

$Gr$Eq$V

public static boolean $Gr$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)

$Ls

public static boolean $Ls(Object arg1,
                          Object arg2)

$Ls$Eq

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

$Ls$Eq$V

public static boolean $Ls$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)

apply2

public Object apply2(Object arg1,
                     Object arg2)
Overrides:
apply2 in interface ProcedureN

apply2

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

applyN

public Object applyN(Object[] args)
Overrides:
applyN in interface ProcedureN

applyWithPromotion

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

checkCompareCode

public static boolean checkCompareCode(int code,
                                       int flags)

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; -2 if either is NaN; -3 if not comparable (either is not a number).

compare

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

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

inline

public Expression inline(ApplyExp exp,
                         ExpWalker walker)
Specified by:
inline in interface CanInline

make

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