public abstract class NumericValue extends AtomicValue implements java.lang.Comparable
typeLabel
EMPTY_CLASS_ARRAY, INDETERMINATE_ORDERING
EMPTY_VALUE_ARRAY
?????? |
---|
NumericValue() |
?????? | ????? |
---|---|
abstract NumericValue |
ceiling()
Implement the XPath ceiling() function
|
abstract int |
compareTo(long other)
Compare the value to a long
|
int |
compareTo(java.lang.Object other)
Compare the value to another numeric value
|
boolean |
equals(java.lang.Object other)
The equals() function compares numeric equality among integers, decimals, floats, doubles, and
their subtypes
|
abstract NumericValue |
floor()
Implement the XPath floor() function
|
java.math.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
|
java.lang.Object |
getXPathComparable(boolean ordered,
StringCollator collator,
XPathContext context)
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 a value is an integer (an instance of a subtype of xs:integer)
|
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(java.lang.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
|
java.lang.String |
toString()
Produce a string representation of the value
|
asAtomic, checkPermittedContents, convert, convert, convertPrimitive, copyAsSubType, effectiveBooleanValue, getCardinality, getComponent, getItemType, getLength, getPrimitiveType, getSchemaComparable, getStringValue, getStringValueCS, getTypedValue, getTypeLabel, isNaN, itemAt, iterate, process, setTypeLabel, subsequence
asItem, asItem, asIterator, asValue, convertToJava, fromItem, getCanonicalLexicalRepresentation, getIterator, iterate, makeQNameValue, reduce, stringToNumber
public static NumericValue parseNumber(java.lang.String in)
in
- the input stringpublic double getDoubleValue()
public float getFloatValue()
public java.math.BigDecimal getDecimalValue() throws XPathException
XPathException
- if the value cannot be converted, for example if it is NaN or infinitepublic static boolean isInteger(AtomicValue value)
value
- the value being testedpublic 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 100public abstract double signum()
public abstract boolean isWholeNumber()
public java.lang.Object getXPathComparable(boolean ordered, StringCollator collator, XPathContext context)
getXPathComparable
??? AtomicValue
ordered
- collator
- context
- public int compareTo(java.lang.Object other)
compareTo
???? java.lang.Comparable
other
- The other numeric valuejava.lang.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 withpublic final boolean equals(java.lang.Object other)
equals
??? AtomicValue
other
- the value to be compared with this onepublic static ItemType promote(ItemType v1, ItemType v2, TypeHierarchy typeHierarchy)
v1
- the item type of the first operandv2
- the item type of the second operandtypeHierarchy
- the type hierarchy cachepublic abstract int hashCode()
hashCode
??? java.lang.Object
public java.lang.String toString()
toString
??? AtomicValue