|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.novell.xml.xpath.NumberValue
Class to represent a number expression value
Field Summary |
Fields inherited from interface com.novell.xml.xpath.ExpressionValue |
BOOLEAN, EXTENDED, NATIVE, NODE_SET, NUMBER, STRING |
Constructor Summary | |
NumberValue()
Construct a default NumberValue for use in casting. |
|
NumberValue(double v)
Construct number value |
Method Summary | |
void |
castFrom(Object type)
Convert from a different type of expression value to the NumberValue type This is used primarily for converting parameters for function calls. |
int |
compareTo(Object other)
Compare this NumberValue to another Object .
|
static double |
convertToNumber(String string)
Convert a string to a number, using the rules for the XPath number() function. |
void |
dump(PrintWriter writer)
Output a human-readable form for the value |
void |
dump(PrintWriter writer,
int indent)
Print the expression in a readable form for debugging. |
boolean |
equals(Object other)
Compares this object against the specified Object . |
ExpressionValue |
evaluate(Node contextNode,
ExpressionContext context)
Evaluate the expression with repect to the passed context |
static Class |
getArgType()
Return the Class object for objects of this type. |
boolean |
getBooleanValue()
Return boolean value of expression value (will convert to boolean if value is not of type boolean) |
Object |
getNativeValue()
return the underlying native value (java.lang.Boolean, java.lang.Double, etc.) |
NodeSet |
getNodeSetValue()
Return node-set value of this ExpressionValue. |
double |
getNumberValue()
Return numeric value of ExpressionValue. |
Class |
getResultType()
Return the Class object describing the result type of the expression. |
String |
getStringValue()
Return string value of this ExpressionValue. |
static String |
getStringValue(double value)
Return string value of a double according to XPath spec |
int |
getValueType()
Return type of expression value |
int |
hashCode()
Returns a hash code for the value in this NumberValue . |
boolean |
isConstant()
Return true if the expression is a constant value. |
void |
registerForReset(XPathResetRegistrar registrar)
Register this expression or any subexpression that implements XPathResetCache with an object that wants to call resetCache() |
String |
toString()
Provide a readable description for debugging. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public NumberValue(double v)
v
- public NumberValue()
Method Detail |
public static Class getArgType()
public String toString()
public static double convertToNumber(String string)
string
- The string to convert.
public ExpressionValue evaluate(Node contextNode, ExpressionContext context)
evaluate
in interface Expression
contextNode
- context node for expression evaluationcontext
- expression context for expression evaluation
public boolean isConstant()
isConstant
in interface Expression
public Class getResultType()
getResultType
in interface Expression
public void registerForReset(XPathResetRegistrar registrar)
resetCache()
registerForReset
in interface Expression
public void dump(PrintWriter writer, int indent)
dump
in interface Expression
writer
- The output device.indent
- Number of tabs to indent the result.public int getValueType()
getValueType
in interface ExpressionValue
public void castFrom(Object type) throws XPathConversionException
castFrom
in interface ExpressionValue
type
- The object to convert from.
XPathConversionException
public boolean getBooleanValue() throws XPathConversionException
getBooleanValue
in interface ExpressionValue
XPathConversionException
public double getNumberValue() throws XPathConversionException
getNumberValue
in interface ExpressionValue
XPathConversionException
public String getStringValue()
getStringValue
in interface ExpressionValue
public static String getStringValue(double value)
public NodeSet getNodeSetValue() throws XPathConversionException
getNodeSetValue
in interface ExpressionValue
XPathConversionException
public Object getNativeValue()
getNativeValue
in interface ExpressionValue
public void dump(PrintWriter writer)
dump
in interface ExpressionValue
writer
- Output devicepublic int hashCode()
NumberValue
. Uses the same algorithm as
java.lang.Double
.
public boolean equals(Object other)
Object
. This will return
true if the other Object
is a NumberValue
or a
java.lang.Double
and the long
values
resulting from java.lang.Double.doubleToLongBits()
are identical.
other
- Object
to which to compare
true
if objects are equalpublic int compareTo(Object other)
NumberValue
to another Object
.
If the other Object
is a NumberValue
or
a java.lang.Double
then the comparison is valid,
otherwise ClassCastException
is
thrown. Behaves like java.lang.Double.compareTo()
.
compareTo
in interface Comparable
other
- Object
to which to compare
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |