org.apache.xpath.objects

Class XNumber

public class XNumber extends XObject

This class represents an XPath number, and is capable of converting the number to other types, such as a string.

UNKNOWN: general

Constructor Summary
XNumber(double d)
Construct a XNodeSet object.
XNumber(Number num)
Construct a XNodeSet object.
Method Summary
booleanbool()
Cast result object to a boolean.
voidcallVisitors(ExpressionOwner owner, XPathVisitor visitor)
booleanequals(XObject obj2)
Tell if two objects are functionally equal.
intgetType()
Tell that this is a CLASS_NUMBER.
StringgetTypeString()
Given a request type, return the equivalent string.
booleanisStableNumber()
Tell if this expression returns a stable number that will not change during iterations within the expression.
doublenum()
Cast result object to a number.
doublenum(XPathContext xctxt)
Evaluate expression to a number.
Objectobject()
Return a java object that's closest to the representation that should be handed to an extension.
Stringstr()
Cast result object to a string.

Constructor Detail

XNumber

public XNumber(double d)
Construct a XNodeSet object.

Parameters: d Value of the object

XNumber

public XNumber(Number num)
Construct a XNodeSet object.

Parameters: num Value of the object

Method Detail

bool

public boolean bool()
Cast result object to a boolean.

Returns: false if the value is NaN or equal to 0.0

callVisitors

public void callVisitors(ExpressionOwner owner, XPathVisitor visitor)

See Also: XPathVisitable

equals

public boolean equals(XObject obj2)
Tell if two objects are functionally equal.

Parameters: obj2 Object to compare this to

Returns: true if the two objects are equal

Throws: javax.xml.transform.TransformerException

getType

public int getType()
Tell that this is a CLASS_NUMBER.

Returns: node type CLASS_NUMBER

getTypeString

public String getTypeString()
Given a request type, return the equivalent string. For diagnostic purposes.

Returns: type string "#NUMBER"

isStableNumber

public boolean isStableNumber()
Tell if this expression returns a stable number that will not change during iterations within the expression. This is used to determine if a proximity position predicate can indicate that no more searching has to occur.

Returns: true if the expression represents a stable number.

num

public double num()
Cast result object to a number.

Returns: the value of the XNumber object

num

public double num(XPathContext xctxt)
Evaluate expression to a number.

Returns: 0.0

Throws: javax.xml.transform.TransformerException

object

public Object object()
Return a java object that's closest to the representation that should be handed to an extension.

Returns: The value of this XNumber as a Double object

str

public String str()
Cast result object to a string.

Returns: "NaN" if the number is NaN, Infinity or -Infinity if the number is infinite or the string value of the number.

Copyright B) 2005 Apache XML Project. All Rights Reserved.