com.icl.saxon.expr
Class NumericValue
java.lang.Object
|
+--com.icl.saxon.expr.Expression
|
+--com.icl.saxon.expr.Value
|
+--com.icl.saxon.expr.NumericValue
- public final class NumericValue
- extends Value
A numeric (floating point) value
Constructor Summary |
NumericValue(double value)
Constructor supplying a double |
NumericValue(java.lang.String s)
Constructor supplying a String |
Method Summary |
boolean |
asBoolean()
Convert the value to a boolean |
double |
asNumber()
Get the value as a number |
java.lang.String |
asString()
Get the value as a String |
java.lang.String |
asStringOLD()
Get the value as a String |
int |
getDataType()
Determine the data type of the exprssion, if possible |
boolean |
isNumeric()
Determine whether the return the type of the expression is numeric. |
java.lang.String |
toString()
Return a string representation for diagnostics |
Methods inherited from class com.icl.saxon.expr.Expression |
containsReferences, enumerate, evaluateAsBoolean, evaluateAsNodeSet, evaluateAsNumber, evaluateAsString, getStaticContext, isRelative, make, make, setStaticContext, usesCurrent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
NumericValue
public NumericValue(double value)
- Constructor supplying a double
NumericValue
public NumericValue(java.lang.String s)
- Constructor supplying a String
asStringOLD
public java.lang.String asStringOLD()
- Get the value as a String
- Returns:
- a String representation of the value
asString
public java.lang.String asString()
- Get the value as a String
- Overrides:
asString
in class Value
- Returns:
- a String representation of the value
asNumber
public double asNumber()
- Get the value as a number
- Overrides:
asNumber
in class Value
- Returns:
- the numeric value
asBoolean
public boolean asBoolean()
- Convert the value to a boolean
- Overrides:
asBoolean
in class Value
- Returns:
- false if zero, true otherwise
getDataType
public int getDataType()
- Determine the data type of the exprssion, if possible
- Overrides:
getDataType
in class Expression
- Returns:
- one of the values Value.STRING, Value.BOOLEAN, Value.NUMBER, Value.NODESET,
Value.FRAGMENT, or Value.ANY (meaning not known in advance)
isNumeric
public boolean isNumeric()
- Description copied from class:
Expression
- Determine whether the return the type of the expression is numeric.
This information is needed if the expression is used as a filter in a path expression
or pattern. If false, the value MAY be numeric (e.g. a variable reference)
- Overrides:
isNumeric
in class Expression
- Following copied from class:
com.icl.saxon.expr.Expression
- Returns:
- true if the expression will definitely return a numeric value.
toString
public java.lang.String toString()
- Return a string representation for diagnostics
- Overrides:
toString
in class java.lang.Object