net.sf.saxon.value
public final class DoubleValue extends NumericValue
Field Summary | |
---|---|
static Pattern | nonExponentialPattern |
static DoubleValue | NaN |
static DoubleValue | NEGATIVE_ZERO |
static DoubleValue | ONE |
static DoubleValue | ZERO |
Constructor Summary | |
---|---|
DoubleValue(CharSequence val)
Constructor supplying a string | |
DoubleValue(double value)
Constructor supplying a double | |
DoubleValue(double value, AtomicType type)
Constructor supplying a double and an AtomicType, for creating
a value that belongs to a user-defined subtype of xs:double. |
Method Summary | |
---|---|
NumericValue | abs()
Get the absolute value as defined by the XPath abs() function |
NumericValue | ceiling()
Implement the XPath ceiling() function |
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 CharSequence | doubleToString(double value)
Internal method used for conversion of a double to a string |
boolean | effectiveBooleanValue()
Get the effective boolean value |
NumericValue | floor()
Implement the XPath floor() function |
CharSequence | getCanonicalLexicalRepresentation()
Get the canonical lexical representation as defined in XML Schema. |
double | getDoubleValue()
Return this numeric value as a double |
CharSequence | getPrimitiveStringValue()
Convert the double to a string according to the XPath 2.0 rules |
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 | isNaN()
Test whether the value is the double/float value NaN |
boolean | isWholeNumber()
Determine whether the value is a whole number, that is, whether it compares
equal to some integer |
static void | main(String[] args) |
NumericValue | negate()
Negate the value |
static void | printInternalForm(double d)
Diagnostic method: print the sign, exponent, and significand |
NumericValue | round()
Implement the XPath round() function |
NumericValue | roundHalfToEven(int scale)
Implement the XPath round-to-half-even() function |
double | signum()
Determine whether the value is negative, zero, or positive |
Parameters: val the string representation of the double value, conforming to the XML Schema lexical representation of xs:double, with leading and trailing spaces permitted
Throws: ValidationException if the string does not have the correct lexical form for a double. Note that the error will contain no error code or context information.
Parameters: value the value of the NumericValue
Parameters: value the value of the NumericValue type the type of the value. This must be a subtype of xs:double, and the value must conform to this type. The methosd does not check these conditions.
Returns: the absolute value
Since: 9.2
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: requiredType an integer identifying the required atomic type validate true if the supplied value must be validated, false if the caller warrants that it is valid context the XPath dynamic context
Returns: an AtomicValue, a value of the required type
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 actual value
Returns: the value converted to a string, according to the XPath casting rules.
Returns: the effective boolean value (true unless the value is zero or NaN)
Returns: the value as a double
Returns: the string 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: d the double to be diagnosed
Returns: -1 if negative, 0 if zero (including negative zero), +1 if positive, NaN if NaN