net.sf.saxon.value
public final class FloatValue extends NumericValue
Field Summary | |
---|---|
static FloatValue | NaN |
static FloatValue | NEGATIVE_ZERO |
static FloatValue | ONE |
static Pattern | roundablePattern
Regex indicating that a number may be worth rounding |
static FloatValue | ZERO |
Constructor Summary | |
---|---|
FloatValue(CharSequence val)
Constructor supplying a string | |
FloatValue(float value)
Constructor supplying a float | |
FloatValue(float value, AtomicType type)
Constructor supplying a float and an AtomicType, for creating
a value that belongs to a user-defined subtype of xs:float. |
Method Summary | |
---|---|
NumericValue | abs()
Get the absolute value as defined by the XPath abs() function |
NumericValue | ceiling()
Implement the XPath ceiling() function |
int | compareTo(Object other) |
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
|
boolean | effectiveBooleanValue()
Get the effective boolean value |
static CharSequence | floatToString(float value)
Internal method used for conversion of a float to a string |
NumericValue | floor()
Implement the XPath floor() function |
CharSequence | getCanonicalLexicalRepresentation()
Get the canonical lexical representation as defined in XML Schema. |
double | getDoubleValue() |
float | getFloatValue()
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 | 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 |
NumericValue | negate()
Negate the value |
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: value the value of the float
Parameters: value the value of the NumericValue type the type of the value. This must be a subtype of xs:float, and the value must conform to this type. The method 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 context XPath dynamic context. Not used when converting from float
Returns: an AtomicValue, a value of the required type; or an ErrorValue
Parameters: typeLabel the type label of the new copy. The caller is responsible for checking that the value actually conforms to this type.
Returns: true unless the value is zero or NaN
Parameters: value the actual value
Returns: the value converted to a string, according to the XPath casting rules.
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.
Returns: -1 if negative, 0 if zero (including negative zero), +1 if positive, NaN if NaN