Class NumberResult

  • All Implemented Interfaces:
    java.io.Serializable

    public final class NumberResult
    extends XPathResult
    Represents a number result. This is an immutable object.
    Version:
    $Revision: 3633 $ $Date: 2003-03-01 08:38:44 +0100 (Sat, 01 Mar 2003) $
    Author:
    Keith Visco
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      NumberResult​(double value)
      Creates a new number result with the given value.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean booleanValue()
      Returns the result as a boolean value.
      boolean equals​(XPathResult result)
      Returns true if the given result is a number result and has the same number value.
      int getResultType()
      Returns the type of this result.
      java.lang.Object javaObject()
      Returns the result as a Java object.
      double numberValue()
      Returns the result as a number value.
      java.lang.String stringValue()
      Returns the result as a string value.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • NaN

        public static final NumberResult NaN
        Number result representing Double.NaN (not a number).
    • Constructor Detail

      • NumberResult

        public NumberResult​(double value)
        Creates a new number result with the given value.
        Parameters:
        value - The number value
    • Method Detail

      • booleanValue

        public boolean booleanValue()
        Returns the result as a boolean value. Returns true if the number value is not zero.
        Specified by:
        booleanValue in class XPathResult
        Returns:
        The result as a boolean value
      • numberValue

        public double numberValue()
        Returns the result as a number value.
        Specified by:
        numberValue in class XPathResult
        Returns:
        The result as a number value
      • stringValue

        public java.lang.String stringValue()
        Returns the result as a string value.
        Specified by:
        stringValue in class XPathResult
        Returns:
        The result as a string value
      • javaObject

        public java.lang.Object javaObject()
        Returns the result as a Java object. Returns an object of type Double with the same number value.
        Specified by:
        javaObject in class XPathResult
        Returns:
        The result as a Java object
      • equals

        public boolean equals​(XPathResult result)
        Returns true if the given result is a number result and has the same number value.
        Specified by:
        equals in class XPathResult
        Parameters:
        result - An XPath result
        Returns:
        True if a number result and has same value
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object