jd.xml.xpath.object
Class XNumber

java.lang.Object
  extended byjd.xml.xpath.object.XObject
      extended byjd.xml.xpath.object.XNumber

public class XNumber
extends XObject

XNumber represents a XPath object with type number.


Field Summary
 
Fields inherited from class jd.xml.xpath.object.XObject
TYPE_BOOLEAN, TYPE_NODESET, TYPE_NUMBER, TYPE_STRING, TYPE_VARIABLE, TYPES
 
Constructor Summary
XNumber(double value)
          Create a new XNumber with the given value.
 
Method Summary
 int canConvertTo(Class javaClass)
          Test if the XObject can be converted to an object with the given class.
 boolean compare(Equality equality, String value)
          Return if this XObject equals the given value.
 boolean equals(Object obj)
          Test if the given object equals this object.
 int getType()
          Return XObject.TYPE_NUMBER.
 int hashCode()
          Return a hashcode for the number.
 boolean toBooleanValue()
          Convert the number to a boolean value.
static boolean toBooleanValue(double value)
          Convert the number to a boolean value.
 double toNumberValue()
          Convert the number to a double value.
static Object toNumberValue(double value, Class javaClass)
          Convert a double value to a Number object.
 String toStringValue()
          Convert the number to a string value.
static String toStringValue(double value)
          Convert the number to a string value.
static String toStringValue(int value)
          Convert the number to a string value.
 Object toValue()
          Return a Double object for this numbers value.
 Object toValue(Class javaClass)
          Convert the objects value to an object of the given class.
 
Methods inherited from class jd.xml.xpath.object.XObject
compare, compare, compare, compare, compare, getTypeName, getTypeName, toNodeSet, toString, toXObject
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XNumber

public XNumber(double value)
Create a new XNumber with the given value.

Method Detail

toValue

public Object toValue()
Return a Double object for this numbers value.

Specified by:
toValue in class XObject

toValue

public Object toValue(Class javaClass)
Convert the objects value to an object of the given class. If the conversion is not possible return null.

Specified by:
toValue in class XObject

toNumberValue

public static Object toNumberValue(double value,
                                   Class javaClass)
Convert a double value to a Number object.


canConvertTo

public int canConvertTo(Class javaClass)
Test if the XObject can be converted to an object with the given class.

Specified by:
canConvertTo in class XObject
Returns:
a positive integer if conversion is possible. The value indicates the conversion preference. A zero value indicates that conversion is not possible.

getType

public int getType()
Return XObject.TYPE_NUMBER.

Specified by:
getType in class XObject

toBooleanValue

public boolean toBooleanValue()
Convert the number to a boolean value.

Specified by:
toBooleanValue in class XObject

toBooleanValue

public static boolean toBooleanValue(double value)
Convert the number to a boolean value.


toNumberValue

public double toNumberValue()
Convert the number to a double value.

Specified by:
toNumberValue in class XObject

toStringValue

public String toStringValue()
Convert the number to a string value.

Specified by:
toStringValue in class XObject

toStringValue

public static String toStringValue(int value)
Convert the number to a string value.


toStringValue

public static String toStringValue(double value)
Convert the number to a string value.


compare

public boolean compare(Equality equality,
                       String value)
Return if this XObject equals the given value.

Specified by:
compare in class XObject

hashCode

public int hashCode()
Return a hashcode for the number.

Overrides:
hashCode in class XObject

equals

public boolean equals(Object obj)
Test if the given object equals this object.

Overrides:
equals in class XObject