com.icl.saxon.expr

Class NumericValue


public final class NumericValue
extends Value

A numeric (floating point) value

Field Summary

Fields inherited from class com.icl.saxon.expr.Value

ANY, BOOLEAN, NODESET, NUMBER, OBJECT, STRING

Fields inherited from class com.icl.saxon.expr.Expression

staticContext

Constructor Summary

NumericValue(String s)
Constructor supplying a String
NumericValue(double value)
Constructor supplying a double

Method Summary

boolean
asBoolean()
Convert the value to a boolean
double
asNumber()
Get the value as a number
String
asString()
Get the value as a String
String
asStringOLD()
Get the value as a String
int
conversionPreference(Class required)
Get conversion preference for this value to a Java class.
Object
convertToJava(Class target)
Convert to Java object (for passing to external functions)
void
display(int level)
Diagnostic print of expression structure
int
getDataType()
Determine the data type of the exprssion, if possible

Methods inherited from class com.icl.saxon.expr.Value

asBoolean, asNumber, asString, compare, conversionPreference, convertToJava, equals, evaluate, getDependencies, inverse, notEquals, numericCompare, reduce, simplify, stringToNumber

Methods inherited from class com.icl.saxon.expr.Expression

containsReferences, display, enumerate, evaluate, evaluateAsBoolean, evaluateAsNodeSet, evaluateAsNumber, evaluateAsString, getDataType, getDependencies, getStaticContext, indent, isContextDocumentNodeSet, make, outputStringValue, reduce, setStaticContext, simplify, usesCurrent

Constructor Details

NumericValue

public NumericValue(String s)
Constructor supplying a String


NumericValue

public NumericValue(double value)
Constructor supplying a double

Method Details

asBoolean

public boolean asBoolean()
Convert the value to a boolean
Overrides:
asBoolean in interface Value

Returns:
false if zero, true otherwise


asNumber

public double asNumber()
Get the value as a number
Overrides:
asNumber in interface Value

Returns:
the numeric value


asString

public String asString()
Get the value as a String
Overrides:
asString in interface Value

Returns:
a String representation of the value


asStringOLD

public String asStringOLD()
Get the value as a String

Returns:
a String representation of the value


conversionPreference

public int conversionPreference(Class required)
Get conversion preference for this value to a Java class. A low result indicates higher preference.
Overrides:
conversionPreference in interface Value


convertToJava

public Object convertToJava(Class target)
            throws XPathException
Convert to Java object (for passing to external functions)
Overrides:
convertToJava in interface Value


display

public void display(int level)
Diagnostic print of expression structure
Overrides:
display in interface Expression


getDataType

public int getDataType()
Determine the data type of the exprssion, if possible
Overrides:
getDataType in interface Expression

Returns:
one of the values Value.STRING, Value.BOOLEAN, Value.NUMBER, Value.NODESET, Value.FRAGMENT, or Value.ANY (meaning not known in advance)