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
public class NumberCompare extends ProcedureN
This implements the numeric comparison relations:<,<=, etc.
-
-
Field Summary
Fields Modifier and Type Field Description static intTRUE_IF_EQUstatic intTRUE_IF_GRTstatic intTRUE_IF_LSSstatic intTRUE_IF_NANstatic intTRUE_IF_NEQ-
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 Constructor Description NumberCompare()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)static booleanapply2(int flags, Object arg1, Object arg2)Objectapply2(Object arg1, Object arg2)ObjectapplyN(Object[] args)static booleanapplyWithPromotion(int flags, Object arg1, Object arg2)static booleancheckCompareCode(int code, int flags)static intcompare(Object arg1, int code1, Object arg2, int code2, boolean exact)static intcompare(Object arg1, Object arg2, boolean exact)Compare two numbers.static intcompareStrict(Object arg1, Object arg2, boolean exact)protected LanguagegetLanguage()static NumberComparemake(Language language, String name, int flags)intnumArgs()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 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
-
-
Method Detail
-
numArgs
public int numArgs()
Description copied from class:ProcedureReturnminArgs()|(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.
-
make
public static NumberCompare make(Language language, String name, int flags)
-
getLanguage
protected final Language getLanguage()
-
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 ifarg1==arg2; -1 ifarg1<arg2; -2 if either isNaN; -3 if not comparable (either is not a number).
-
-