| 
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectnet.sf.saxon.value.Value
net.sf.saxon.value.AtomicValue
net.sf.saxon.value.NumericValue
public abstract class NumericValue
NumericValue is an abstract superclass for IntegerValue, DecimalValue, FloatValue, and DoubleValue
| Field Summary | 
|---|
| Fields inherited from class net.sf.saxon.value.Value | 
|---|
EMPTY_CLASS_ARRAY, INDETERMINATE_ORDERING | 
| Fields inherited from interface net.sf.saxon.om.ValueRepresentation | 
|---|
EMPTY_VALUE_ARRAY | 
| Constructor Summary | |
|---|---|
NumericValue()
 | 
|
| Method Summary | |
|---|---|
abstract  NumericValue | 
arithmetic(int operator,
           NumericValue other,
           XPathContext context)
Perform a binary arithmetic operation  | 
abstract  NumericValue | 
ceiling()
Implement the XPath ceiling() function  | 
abstract  int | 
compareTo(long other)
Compare the value to a long  | 
 int | 
compareTo(Object other)
Compare the value to another numeric value  | 
 boolean | 
equals(Object other)
The equals() function compares numeric equality among integers, decimals, floats, doubles, and their subtypes  | 
abstract  NumericValue | 
floor()
Implement the XPath floor() function  | 
 BigDecimal | 
getDecimalValue()
Get the numeric value converted to a decimal  | 
 double | 
getDoubleValue()
Get the numeric value as a double  | 
 float | 
getFloatValue()
Get the numeric value converted to a float  | 
 Comparable | 
getXPathComparable()
Get a Comparable value that implements the XPath ordering comparison semantics for this value.  | 
abstract  int | 
hashCode()
hashCode() must be the same for two values that are equal.  | 
static boolean | 
isInteger(AtomicValue value)
Test whether the value is an integer (an instance of a subtype of xs:integer)  | 
 boolean | 
isNaN()
Test whether the value is the double/float value NaN  | 
abstract  boolean | 
isWholeNumber()
Determine whether the value is a whole number, that is, whether it compares equal to some integer  | 
 long | 
longValue()
Return the numeric value as a Java long.  | 
abstract  NumericValue | 
negate()
Change the sign of the number  | 
static NumericValue | 
parseNumber(String in)
Get a numeric value by parsing a string; the type of numeric value depends on the lexical form of the string, following the rules for XPath numeric literals.  | 
static ItemType | 
promote(ItemType v1,
        ItemType v2,
        TypeHierarchy typeHierarchy)
Identify lowest common supertype of two numeric values for promotion purposes  | 
abstract  NumericValue | 
round()
Implement the XPath round() function  | 
abstract  NumericValue | 
roundHalfToEven(int scale)
Implement the XPath 2.0 round-half-to-even() function  | 
abstract  double | 
signum()
Determine whether the value is negative, zero, or positive  | 
 String | 
toString()
Produce a string representation of the value  | 
| Methods inherited from class net.sf.saxon.value.AtomicValue | 
|---|
checkPermittedContents, convert, convert, convertPrimitive, copy, effectiveBooleanValue, getCardinality, getComponent, getItemType, getLength, getPrimitiveType, getStringValue, getStringValueCS, getTypedValue, getTypeLabel, hasBuiltInType, isMultiValued, itemAt, iterate, process, setTypeLabel | 
| Methods inherited from class net.sf.saxon.value.Value | 
|---|
asItem, asItem, asIterator, asValue, convert, convertJavaObjectToXPath, convertToJava, fromItem, getCanonicalLexicalRepresentation, getIterator, getSchemaComparable, iterate, makeQNameValue, reduce, stringToNumber | 
| Methods inherited from class java.lang.Object | 
|---|
getClass, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public NumericValue()
| Method Detail | 
|---|
public static NumericValue parseNumber(String in)
in - the input string
public double getDoubleValue()
public float getFloatValue()
public BigDecimal getDecimalValue()
                           throws XPathException
XPathException - if the value cannot be converted, for example if it is NaN or infinitepublic boolean isNaN()
public static boolean isInteger(AtomicValue value)
public long longValue()
               throws XPathException
XPathException - if the value cannot be convertedpublic abstract NumericValue negate()
public abstract NumericValue floor()
public abstract NumericValue ceiling()
public abstract NumericValue round()
public abstract NumericValue roundHalfToEven(int scale)
scale - the decimal position for rounding: e.g. 2 rounds to a
     multiple of 0.01, while -2 rounds to a multiple of 100
public abstract double signum()
public abstract NumericValue arithmetic(int operator,
                                        NumericValue other,
                                        XPathContext context)
                                 throws XPathException
operator - the binary arithmetic operation to be performed. Uses
     the constants defined in the Token class, for example
     Token.PLUS, Token.MINUSother - the second operand
XPathException - if an arithmetic error occursTokenizerpublic abstract boolean isWholeNumber()
public Comparable getXPathComparable()
getXPathComparable in class AtomicValuepublic int compareTo(Object other)
compareTo in interface ComparablecompareTo in class Valueother - The other numeric value
ClassCastException - if the other value is not a NumericValue
     (the parameter is declared as Object to satisfy the Comparable
     interface)public abstract int compareTo(long other)
other - the value to be compared with
public final boolean equals(Object other)
equals in class Valueother - the value to be compared with this one
public static ItemType promote(ItemType v1,
                               ItemType v2,
                               TypeHierarchy typeHierarchy)
v1 - the item type of the first operandv2 - the item type of the second operandtypeHierarchy - 
public abstract int hashCode()
hashCode in class Valuepublic String toString()
toString in class AtomicValue
  | 
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||