Package gnu.kawa.functions
Class NumberCompare
java.lang.Object
gnu.mapping.PropertySet
gnu.mapping.Procedure
gnu.mapping.ProcedureN
gnu.kawa.functions.NumberCompare
- All Implemented Interfaces:
Named
This implements the numeric comparison relations:
<
, <=
, etc.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
Fields inherited from class gnu.mapping.ProcedureN
applyToObject, noArgs
Fields inherited from class gnu.mapping.Procedure
applyMethodType, applyToConsumerDefault, applyToConsumerMethod, applyToObjectDefault, applyToObjectMethod, compilerKey, compilerXKey, inlineIfConstantSymbol, validateApplyKey, validateXApplyKey
Fields inherited from class gnu.mapping.PropertySet
nameKey
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
static boolean
static boolean
static boolean
static boolean
static boolean
static boolean
static boolean
static boolean
static boolean
static boolean
static boolean
applyWithPromotion
(int flags, Object arg1, Object arg2) static boolean
checkCompareCode
(int code, int flags) static int
static int
Compare two numbers.static int
compareStrict
(Object arg1, Object arg2, boolean exact) protected final Language
static NumberCompare
int
numArgs()
ReturnminArgs()|(maxArgs<<12)
.Methods inherited from class gnu.mapping.ProcedureN
applyToObject
Methods inherited from class gnu.mapping.Procedure
apply0, apply1, apply3, apply4, applyL, applyToConsumerDefault, applyToObjectDefault, checkArgCount, checkBadCode, getApplyMethod, getApplyToConsumerMethod, getApplyToObjectMethod, getReturnType, getSetter, getSourceLocation, isSideEffectFree, lookupApplyHandle, maxArgs, maxArgs, minArgs, minArgs, 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_GRT
public static final int TRUE_IF_GRT- See Also:
-
TRUE_IF_EQU
public static final int TRUE_IF_EQU- See Also:
-
TRUE_IF_LSS
public static final int TRUE_IF_LSS- See Also:
-
TRUE_IF_NAN
public static final int TRUE_IF_NAN- See Also:
-
TRUE_IF_NEQ
public static final int TRUE_IF_NEQ- See Also:
-
-
Constructor Details
-
NumberCompare
public NumberCompare()
-
-
Method Details
-
numArgs
public int numArgs()Description copied from class:Procedure
ReturnminArgs()|(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. -
$Eq
-
$Gr
-
$Gr$Eq
-
$Ls
-
$Ls$Eq
-
$Eq$V
-
$Gr$V
-
$Gr$Eq$V
-
$Ls$V
-
$Ls$Eq$V
-
make
-
getLanguage
-
apply2
-
apply2
-
checkCompareCode
public static boolean checkCompareCode(int code, int flags) -
applyWithPromotion
-
compare
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 ifarg1==arg2
; -1 ifarg1<arg2
; -2 if either isNaN
; -3 if not comparable (either is not a number).
-
compareStrict
-
compare
-
applyN
-