com.icl.saxon.expr

Class NumericValue

public final class NumericValue extends Value

A numeric (floating point) value
Constructor Summary
NumericValue(double value)
Constructor supplying a double
NumericValue(String s)
Constructor supplying a String
Method Summary
booleanasBoolean()
Convert the value to a boolean
doubleasNumber()
Get the value as a number
StringasString()
Get the value as a String
StringasStringOLD()
Get the value as a String
intconversionPreference(Class required)
Get conversion preference for this value to a Java class.
ObjectconvertToJava(Class target)
Convert to Java object (for passing to external functions)
voiddisplay(int level)
Diagnostic print of expression structure
intgetDataType()
Determine the data type of the exprssion, if possible

Constructor Detail

NumericValue

public NumericValue(double value)
Constructor supplying a double

UNKNOWN: the value of the NumericValue

NumericValue

public NumericValue(String s)
Constructor supplying a String

UNKNOWN: the numeric value expressed as a String

Method Detail

asBoolean

public boolean asBoolean()
Convert the value to a boolean

Returns: false if zero, true otherwise

asNumber

public double asNumber()
Get the value as a number

Returns: the numeric value

asString

public String asString()
Get the value as a String

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.

convertToJava

public Object convertToJava(Class target)
Convert to Java object (for passing to external functions)

display

public void display(int level)
Diagnostic print of expression structure

getDataType

public int getDataType()
Determine the data type of the exprssion, if possible

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