org.ucl.xpath.types
Class XSDouble

java.lang.Object
  extended byorg.ucl.xpath.types.AnyType
      extended byorg.ucl.xpath.types.AnySimpleType
          extended byorg.ucl.xpath.types.AnyAtomicType
              extended byorg.ucl.xpath.types.CtrType
                  extended byorg.ucl.xpath.types.NumericType
                      extended byorg.ucl.xpath.types.XSDouble
All Implemented Interfaces:
CmpEq, CmpGt, CmpLt, MathDiv, MathIDiv, MathMinus, MathMod, MathPlus, MathTimes

public class XSDouble
extends NumericType

A representation of the Double datatype


Constructor Summary
XSDouble()
          Initialises a representation of 0
XSDouble(double x)
          Initialises a representation of the supplied number
XSDouble(java.lang.String init)
          Initialises using a String represented number
 
Method Summary
 NumericType abs()
          Absolutes the number stored
 NumericType ceiling()
          Returns the smallest integer greater than the number stored
 ResultSequence constructor(ResultSequence arg)
          Creates a new result sequence consisting of the retrievable double number in the supplied result sequence
 ResultSequence div(ResultSequence arg)
          Mathematical division operator between this XSDouble and the supplied ResultSequence.
 double double_value()
          Retrieves the actual value of the number stored
 boolean eq(AnyType aa)
          Equality comparison between this number and the supplied representation.
 NumericType floor()
          Returns the largest integer smaller than the number stored
 boolean gt(AnyType arg)
          Comparison between this number and the supplied representation.
 ResultSequence idiv(ResultSequence arg)
          Mathematical integer division operator between this XSDouble and the supplied ResultSequence.
 boolean lt(AnyType arg)
          Comparison between this number and the supplied representation.
 ResultSequence minus(ResultSequence arg)
          Mathematical subtraction operator between this XSDouble and the supplied ResultSequence.
 ResultSequence mod(ResultSequence arg)
          Mathematical modulus operator between this XSDouble and the supplied ResultSequence.
 boolean nan()
          Check for whether this XSDouble represents NaN
static XSDouble parse_double(java.lang.String i)
          Creates a new representation of the String represented number
 ResultSequence plus(ResultSequence arg)
          Mathematical addition operator between this XSDouble and the supplied ResultSequence.
 NumericType round_half_to_even()
          Returns the closest integer of the number stored.
 NumericType round()
          Returns the closest integer of the number stored.
 java.lang.String string_type()
          Retrieves the datatype's full pathname
 java.lang.String string_value()
          Retrieves a String representation of the Decimal value stored
 ResultSequence times(ResultSequence arg)
          Mathematical multiplication operator between this XSDouble and the supplied ResultSequence.
 java.lang.String type_name()
          Retrieves the datatype's name
 ResultSequence unary_minus()
          Negation of the number stored
 boolean zero()
          Check for whether this XSDouble represents 0
 
Methods inherited from class org.ucl.xpath.types.NumericType
get_single_arg, get_single_type, get_single_type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSDouble

public XSDouble(double x)
Initialises a representation of the supplied number

Parameters:
x - Number to be stored

XSDouble

public XSDouble()
Initialises a representation of 0


XSDouble

public XSDouble(java.lang.String init)
         throws DynamicError
Initialises using a String represented number

Parameters:
init - String representation of the number to be stored
Method Detail

parse_double

public static XSDouble parse_double(java.lang.String i)
Creates a new representation of the String represented number

Parameters:
i - String representation of the number to be stored
Returns:
New XSDouble representing the number supplied

constructor

public ResultSequence constructor(ResultSequence arg)
                           throws DynamicError
Creates a new result sequence consisting of the retrievable double number in the supplied result sequence

Specified by:
constructor in class CtrType
Parameters:
arg - The result sequence from which to extract the double number.
Returns:
A new result sequence consisting of the double number supplied.
Throws:
DynamicError

string_type

public java.lang.String string_type()
Retrieves the datatype's full pathname

Specified by:
string_type in class AnyType
Returns:
"xs:double" which is the datatype's full pathname

type_name

public java.lang.String type_name()
Retrieves the datatype's name

Specified by:
type_name in class CtrType
Returns:
"double" which is the datatype's name

string_value

public java.lang.String string_value()
Retrieves a String representation of the Decimal value stored

Specified by:
string_value in class AnyType
Returns:
String representation of the Decimal value stored

nan

public boolean nan()
Check for whether this XSDouble represents NaN

Returns:
True if this XSDouble represents NaN. False otherwise.

zero

public boolean zero()
Check for whether this XSDouble represents 0

Specified by:
zero in class NumericType
Returns:
True if this XSDouble represents 0. False otherwise.

double_value

public double double_value()
Retrieves the actual value of the number stored

Returns:
The actual value of the number stored

eq

public boolean eq(AnyType aa)
           throws DynamicError
Equality comparison between this number and the supplied representation. Currently no numeric type promotion exists so the supplied representation must be of type XSDouble.

Parameters:
aa - Representation to be compared with (must currently be of type XSDouble)
Returns:
True if the 2 representations represent the same number. False otherwise
Throws:
DynamicError - Dynamic error.

gt

public boolean gt(AnyType arg)
           throws DynamicError
Comparison between this number and the supplied representation. Currently no numeric type promotion exists so the supplied representation must be of type XSDouble.

Parameters:
arg - Representation to be compared with (must currently be of type XSDouble)
Returns:
True if the supplied type represents a number smaller than this one stored. False otherwise
Throws:
DynamicError - Dynamic error.

lt

public boolean lt(AnyType arg)
           throws DynamicError
Comparison between this number and the supplied representation. Currently no numeric type promotion exists so the supplied representation must be of type XSDouble.

Parameters:
arg - Representation to be compared with (must currently be of type XSDouble)
Returns:
True if the supplied type represents a number greater than this one stored. False otherwise
Throws:
DynamicError - Dynamic error.

plus

public ResultSequence plus(ResultSequence arg)
                    throws DynamicError
Mathematical addition operator between this XSDouble and the supplied ResultSequence. Due to no numeric type promotion or conversion, the ResultSequence must be of type XSDouble.

Parameters:
arg - The ResultSequence to perform an addition with
Returns:
A XSDouble consisting of the result of the mathematical addition.
Throws:
DynamicError - Dynamic error.

minus

public ResultSequence minus(ResultSequence arg)
                     throws DynamicError
Mathematical subtraction operator between this XSDouble and the supplied ResultSequence. Due to no numeric type promotion or conversion, the ResultSequence must be of type XSDouble.

Parameters:
arg - The ResultSequence to perform an subtraction with
Returns:
A XSDouble consisting of the result of the mathematical subtraction.
Throws:
DynamicError - Dynamic error.

times

public ResultSequence times(ResultSequence arg)
                     throws DynamicError
Mathematical multiplication operator between this XSDouble and the supplied ResultSequence. Due to no numeric type promotion or conversion, the ResultSequence must be of type XSDouble.

Parameters:
arg - The ResultSequence to perform an multiplication with
Returns:
A XSDouble consisting of the result of the mathematical multiplication.
Throws:
DynamicError - Dynamic error.

div

public ResultSequence div(ResultSequence arg)
                   throws DynamicError
Mathematical division operator between this XSDouble and the supplied ResultSequence. Due to no numeric type promotion or conversion, the ResultSequence must be of type XSDouble.

Parameters:
arg - The ResultSequence to perform an division with
Returns:
A XSDouble consisting of the result of the mathematical division.
Throws:
DynamicError - Dynamic error.

idiv

public ResultSequence idiv(ResultSequence arg)
                    throws DynamicError
Mathematical integer division operator between this XSDouble and the supplied ResultSequence. Due to no numeric type promotion or conversion, the ResultSequence must be of type XSDouble.

Parameters:
arg - The ResultSequence to perform an integer division with
Returns:
A XSInteger consisting of the result of the mathematical integer division.
Throws:
DynamicError - Dynamic error.

mod

public ResultSequence mod(ResultSequence arg)
                   throws DynamicError
Mathematical modulus operator between this XSDouble and the supplied ResultSequence. Due to no numeric type promotion or conversion, the ResultSequence must be of type XSDouble.

Parameters:
arg - The ResultSequence to perform a modulus with
Returns:
A XSDouble consisting of the result of the mathematical modulus.
Throws:
DynamicError - Dynamic error.

unary_minus

public ResultSequence unary_minus()
Negation of the number stored

Specified by:
unary_minus in class NumericType
Returns:
A XSDouble representing the negation of this XSDecimal

abs

public NumericType abs()
Absolutes the number stored

Specified by:
abs in class NumericType
Returns:
A XSDouble representing the absolute value of the number stored

ceiling

public NumericType ceiling()
Returns the smallest integer greater than the number stored

Specified by:
ceiling in class NumericType
Returns:
A XSDouble representing the smallest integer greater than the number stored

floor

public NumericType floor()
Returns the largest integer smaller than the number stored

Specified by:
floor in class NumericType
Returns:
A XSDouble representing the largest integer smaller than the number stored

round

public NumericType round()
Returns the closest integer of the number stored.

Specified by:
round in class NumericType
Returns:
A XSDouble representing the closest long of the number stored.

round_half_to_even

public NumericType round_half_to_even()
Returns the closest integer of the number stored.

Specified by:
round_half_to_even in class NumericType
Returns:
A XSDouble representing the closest long of the number stored.