APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xpath.internal.objects

public Class XNumber

extends XObject
Class Inheritance
Imports
com.sun.org.apache.xpath.internal.ExpressionOwner, .XPathContext, .XPathVisitor

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

Field Summary

Modifier and TypeField and Description
pack-priv double
m_val

Value of the XNumber object.

pack-priv static final long
Inherited from com.sun.org.apache.xpath.internal.objects.XObject:
CLASS_BOOLEANCLASS_NODESETCLASS_NULLCLASS_NUMBERCLASS_RTREEFRAGCLASS_STRINGCLASS_UNKNOWNCLASS_UNRESOLVEDVARIABLEm_obj

Constructor Summary

AccessConstructor and Description
public
XNumber(double
Value of the object
d
)

Construct a XNodeSet object.

public
XNumber(Number
Value of the object
num
)

Construct a XNodeSet object.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

false if the value is NaN or equal to 0.0
bool
()

Overrides com.sun.org.apache.xpath.internal.objects.XObject.bool.

Cast result object to a boolean.

public void
callVisitors(ExpressionOwner owner, XPathVisitor visitor)

Overrides com.sun.org.apache.xpath.internal.objects.XObject.callVisitors.

Implements com.sun.org.apache.xpath.internal.XPathVisitable.callVisitors.

This will traverse the heararchy, calling the visitor for each member.

public boolean

Returns:

true if the two objects are equal
equals
(XObject
Object to compare this to
obj2
)

Overrides com.sun.org.apache.xpath.internal.objects.XObject.equals.

Tell if two objects are functionally equal.

public int

Returns:

node type CLASS_NUMBER
getType
()

Overrides com.sun.org.apache.xpath.internal.objects.XObject.getType.

Tell that this is a CLASS_NUMBER.

public String

Returns:

type string "#NUMBER"
getTypeString
()

Overrides com.sun.org.apache.xpath.internal.objects.XObject.getTypeString.

Given a request type, return the equivalent string.

public boolean

Returns:

true if the expression represents a stable number.
isStableNumber
()

Overrides com.sun.org.apache.xpath.internal.Expression.isStableNumber.

Tell if this expression returns a stable number that will not change during iterations within the expression.

public double

Returns:

the value of the XNumber object
num
()

Overrides com.sun.org.apache.xpath.internal.objects.XObject.num.

Cast result object to a number.

public double

Returns:

0.0
num
(XPathContext xctxt)

Overrides com.sun.org.apache.xpath.internal.Expression.num.

Evaluate expression to a number.

public Object

Returns:

The value of this XNumber as a Double object
object
()

Overrides com.sun.org.apache.xpath.internal.objects.XObject.object.

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

public String

Returns:

"NaN" if the number is NaN, Infinity or -Infinity if the number is infinite or the string value of the number.
str
()

Overrides com.sun.org.apache.xpath.internal.objects.XObject.str.

Cast result object to a string.

private static String

Returns:

a string of '0' with the given length
zeros
(int
Length of the string to be returned
n
)

Return a string of '0' of the given length

Inherited from com.sun.org.apache.xpath.internal.objects.XObject:
allowDetachToReleaseappendToFsbboolWithSideEffectscastToTypecreatecreatedeepEqualsdestructdetachdispatchCharactersEventserrorerrorexecutefixupVariablesgetFreshgreaterThangreaterThanOrEqualiterlessThanlessThanOrEqualmutableNodesetnodelistnodesetnotEqualsnumWithSideEffectsresetrtfrtfrtreertreesetObjecttoStringxstr

Field Detail

m_valback to summary
pack-priv double m_val

Value of the XNumber object.

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides com.sun.org.apache.xpath.internal.objects.XObject.serialVersionUID.

Constructor Detail

XNumberback to summary
public XNumber(double d)

Construct a XNodeSet object.

Parameters
d:double

Value of the object

XNumberback to summary
public XNumber(Number num)

Construct a XNodeSet object.

Parameters
num:Number

Value of the object

Method Detail

boolback to summary
public boolean bool()

Overrides com.sun.org.apache.xpath.internal.objects.XObject.bool.

Cast result object to a boolean.

Returns:boolean

false if the value is NaN or equal to 0.0

callVisitorsback to summary
public void callVisitors(ExpressionOwner owner, XPathVisitor visitor)

Overrides com.sun.org.apache.xpath.internal.objects.XObject.callVisitors.

Implements com.sun.org.apache.xpath.internal.XPathVisitable.callVisitors.

Doc from com.sun.org.apache.xpath.internal.XPathVisitable.callVisitors.

This will traverse the heararchy, calling the visitor for each member. If the called visitor method returns false, the subtree should not be called.

See Also
com.sun.org.apache.xpath.internal.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor)
equalsback to summary
public boolean equals(XObject obj2)

Overrides com.sun.org.apache.xpath.internal.objects.XObject.equals.

Tell if two objects are functionally equal.

Parameters
obj2:XObject

Object to compare this to

Returns:boolean

true if the two objects are equal

getTypeback to summary
public int getType()

Overrides com.sun.org.apache.xpath.internal.objects.XObject.getType.

Tell that this is a CLASS_NUMBER.

Returns:int

node type CLASS_NUMBER

getTypeStringback to summary
public String getTypeString()

Overrides com.sun.org.apache.xpath.internal.objects.XObject.getTypeString.

Given a request type, return the equivalent string. For diagnostic purposes.

Returns:String

type string "#NUMBER"

isStableNumberback to summary
public boolean isStableNumber()

Overrides com.sun.org.apache.xpath.internal.Expression.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:boolean

true if the expression represents a stable number.

numback to summary
public double num()

Overrides com.sun.org.apache.xpath.internal.objects.XObject.num.

Cast result object to a number.

Returns:double

the value of the XNumber object

numback to summary
public double num(XPathContext xctxt) throws TransformerException

Overrides com.sun.org.apache.xpath.internal.Expression.num.

Evaluate expression to a number.

Returns:double

0.0

objectback to summary
public Object object()

Overrides com.sun.org.apache.xpath.internal.objects.XObject.object.

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

Returns:Object

The value of this XNumber as a Double object

strback to summary
public String str()

Overrides com.sun.org.apache.xpath.internal.objects.XObject.str.

Cast result object to a string.

Returns:String

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

zerosback to summary
private static String zeros(int n)

Return a string of '0' of the given length

Parameters
n:int

Length of the string to be returned

Returns:String

a string of '0' with the given length