|
||||||||||
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
NumericValue is an abstract superclass for IntegerValue, DecimalValue, FloatValue, and DoubleValue
Constructor Summary | |
NumericValue()
|
Method Summary | |
abstract NumericValue |
arithmetic(int operator,
NumericValue other)
Perform a binary arithmetic operation |
double |
asDouble()
Get the numeric value as a double |
long |
asLong()
Return the numeric value as a Java long. |
abstract NumericValue |
ceiling()
Implement the XPath ceiling() function |
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 |
abstract int |
hashCode()
hashCode() must be the same for two values that are equal. |
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 |
abstract NumericValue |
negate()
Change the sign of the number |
static ItemType |
promote(ItemType v1,
ItemType v2)
Identify lowest common supertype of two numeric values for promotion purposes |
abstract NumericValue |
round()
Implement the XPath round() function |
abstract NumericValue |
roundToHalfEven(int scale)
Implement the XPath 2.0 round-to-half-even() function |
java.lang.String |
toString()
Produce a string representation of the value |
Methods inherited from class net.sf.saxon.value.AtomicValue |
conversionPreference, convert, convert, convert, convertToJava, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getComponent, getPrimitiveValue, getTypedValue, iterate |
Methods inherited from class net.sf.saxon.value.Value |
analyze, asItem, asValue, collapseWhitespace, getDependencies, getSpecialProperties, getSubExpressions, inverse, normalizeWhitespace, promote, simplify, stringToInteger, stringToNumber, trimWhitespace |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sf.saxon.om.Item |
getStringValue |
Methods inherited from interface net.sf.saxon.expr.Expression |
display, getItemType |
Constructor Detail |
public NumericValue()
Method Detail |
public double asDouble()
public boolean isNaN()
public long asLong() throws XPathException
XPathException
- if the value cannot be convertedpublic abstract NumericValue negate() throws XPathException
XPathException
- if the conversion is not possiblepublic abstract NumericValue floor()
public abstract NumericValue ceiling()
public abstract NumericValue round()
public abstract NumericValue roundToHalfEven(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 NumericValue arithmetic(int operator, NumericValue other) throws XPathException
operator
- the binary arithmetic operation to be performed. Uses
the constants defined in the Tokenizer classother
- the other operand
XPathException
- if an arithmetic error occursTokenizer
public abstract boolean isWholeNumber()
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
other
- The other numeric value
java.lang.ClassCastException
- if the other value is not a NumericValue
(the parameter is declared as Object to satisfy the Comparable
interface)public final boolean equals(java.lang.Object other)
other
- the value to be compared with this one
public static ItemType promote(ItemType v1, ItemType v2)
v1
- the item type of the first operandv2
- the item type of the second operand
public abstract int hashCode()
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |