net.sf.saxon.value
public final class DecimalValue extends NumericValue
Nested Class Summary | |
---|---|
protected static class | DecimalValue.DecimalComparable |
Field Summary | |
---|---|
static BigDecimal | BIG_DECIMAL_ONE |
static BigDecimal | BIG_DECIMAL_ONE_MILLION |
static BigInteger | BIG_INTEGER_TEN |
static int | DIVIDE_PRECISION |
static DecimalValue | ONE |
static DecimalValue | ZERO |
Constructor Summary | |
---|---|
DecimalValue(BigDecimal value)
Constructor supplying a BigDecimal | |
DecimalValue(double in)
Constructor supplying a double | |
DecimalValue(long in)
Constructor supplying a long integer |
Method Summary | |
---|---|
NumericValue | abs()
Get the absolute value as defined by the XPath abs() function |
static boolean | castableAsDecimal(CharSequence in)
Test whether a string is castable to a decimal value |
NumericValue | ceiling()
Implement the XPath ceiling() function |
int | compareTo(Object other)
Compare the value to another numeric value |
int | compareTo(long other)
Compare the value to a long |
ConversionResult | convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
Convert to target data type |
AtomicValue | copyAsSubType(AtomicType typeLabel)
Create a copy of this atomic value, with a different type label
|
static FastStringBuffer | decimalToString(BigDecimal value, FastStringBuffer fsb)
Convert a decimal value to a string, using the XPath rules for formatting |
boolean | effectiveBooleanValue() |
NumericValue | floor()
Implement the XPath floor() function |
CharSequence | getCanonicalLexicalRepresentation()
Get the canonical lexical representation as defined in XML Schema. |
BigDecimal | getDecimalValue()
Get the value |
CharSequence | getPrimitiveStringValue()
Get the value as a String |
BuiltInAtomicType | getPrimitiveType()
Determine the primitive type of the value. |
Comparable | getSchemaComparable()
Get an object that implements XML Schema comparison semantics |
int | hashCode()
Get the hashCode. |
boolean | isIdentical(Value v)
Determine whether two atomic values are identical, as determined by XML Schema rules. |
boolean | isWholeNumber()
Determine whether the value is a whole number, that is, whether it compares
equal to some integer |
static ConversionResult | makeDecimalValue(CharSequence in, boolean validate)
Factory method to construct a DecimalValue from a string |
NumericValue | negate()
Negate the value |
NumericValue | round()
Implement the XPath round() function |
NumericValue | roundHalfToEven(int scale)
Implement the XPath round-half-to-even() function |
double | signum()
Determine whether the value is negative, zero, or positive |
Parameters: value the value of the DecimalValue
Parameters: in the value of the DecimalValue
Parameters: in the value of the DecimalValue
Returns: the absolute value
Since: 9.2
Parameters: in the string to be tested
Returns: true if the string has the correct format for a decimal
Parameters: other the value to be compared with
Returns: -1 if this is less, 0 if this is equal, +1 if this is greater or if this is NaN
Parameters: typeLabel the type label of the new copy. The caller is responsible for checking that the value actually conforms to this type.
Parameters: value the decimal value to be converted fsb the FastStringBuffer to which the value is to be appended
Returns: the supplied FastStringBuffer, suitably populated
Returns: a String representation of the value
See Also: NumericValue
Note that even this check ignores the type annotation of the value. The integer 3 and the short 3 are considered identical, even though they are not fully interchangeable. "Identical" means the same point in the value space, regardless of type annotation.
NaN is identical to itself.
Parameters: v the other value to be compared with this one
Returns: true if the two values are identical, false otherwise.
Parameters: in the value of the DecimalValue validate true if validation is required; false if the caller knows that the value is valid
Returns: the required DecimalValue if the input is valid, or a ValidationFailure encapsulating the error message if not.
Returns: -1 if negative, 0 if zero, +1 if positive, NaN if NaN