org.ucl.xpath.types
Class XDTYearMonthDuration

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.XSDuration
                      extended byorg.ucl.xpath.types.XDTYearMonthDuration
All Implemented Interfaces:
CmpEq, CmpGt, CmpLt, MathDiv, MathMinus, MathPlus, MathTimes

public class XDTYearMonthDuration
extends XSDuration
implements CmpEq, CmpLt, CmpGt, MathPlus, MathMinus, MathTimes, MathDiv

A representation of the YearMonthDuration datatype


Constructor Summary
XDTYearMonthDuration()
          Initialises to a duration of no time (0years and 0months)
XDTYearMonthDuration(int months)
          Initialises to the given number of months
XDTYearMonthDuration(int year, int month, boolean negative)
          Initialises using the supplied parameters.
 
Method Summary
 ResultSequence constructor(ResultSequence arg)
          Creates a new ResultSequence consisting of the extractable time duration from the supplied ResultSequence
 ResultSequence div(ResultSequence arg)
          Mathematical division between this duration stored and the supplied duration of time (of type XDTYearMonthDuration)
 boolean eq(AnyType arg)
          Equality comparison between this and the supplied duration of time.
 boolean gt(AnyType arg)
          Comparison between this and the supplied duration of time.
 boolean lt(AnyType arg)
          Comparison between this and the supplied duration of time.
 ResultSequence minus(ResultSequence arg)
          Mathematical subtraction between this duration stored and the supplied duration of time (of type XDTYearMonthDuration)
 int month()
          Retrieves the number of months within the duration of time stored
 boolean negative()
          Retrieves whether this duration represents a backward passage through time
static XDTYearMonthDuration parseYMDuration(java.lang.String str)
          Creates a new XDTYearMonthDuration by parsing the supplied String represented duration of time
 ResultSequence plus(ResultSequence arg)
          Mathematical addition between this duration stored and the supplied duration of time (of type XDTYearMonthDuration)
 java.lang.String string_type()
          Retrieves the datatype's full pathname
 java.lang.String string_value()
          Retrieves a String representation of the duration of time stored
 ResultSequence times(ResultSequence arg)
          Mathematical multiplication between this duration stored and the supplied duration of time (of type XDTYearMonthDuration)
 java.lang.String type_name()
          Retrives the datatype's name
 int value()
          Retrieves the duration of time stored as the number of months within it
 int year()
          Retrieves the number of years within the duration of time stored
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XDTYearMonthDuration

public XDTYearMonthDuration(int year,
                            int month,
                            boolean negative)
Initialises using the supplied parameters. If the number of months supplied is more than 12, the number of years is adjusted accordingly.

Parameters:
year - Number of years in this duration of time
month - Number of months in this duration of time
negative - True if this duration of time represents a backwards passage through time. False otherwise

XDTYearMonthDuration

public XDTYearMonthDuration(int months)
Initialises to the given number of months

Parameters:
months - Number of months in the duration of time

XDTYearMonthDuration

public XDTYearMonthDuration()
Initialises to a duration of no time (0years and 0months)

Method Detail

parseYMDuration

public static XDTYearMonthDuration parseYMDuration(java.lang.String str)
Creates a new XDTYearMonthDuration by parsing the supplied String represented duration of time

Parameters:
str - String represented duration of time
Returns:
New XDTYearMonthDuration representing the duration of time supplied

type_name

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

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

constructor

public ResultSequence constructor(ResultSequence arg)
                           throws DynamicError
Creates a new ResultSequence consisting of the extractable time duration from the supplied ResultSequence

Specified by:
constructor in class CtrType
Parameters:
arg - The ResultSequence from which to extract
Returns:
New ResultSequence consisting of the time duration extracted
Throws:
DynamicError

negative

public boolean negative()
Retrieves whether this duration represents a backward passage through time

Returns:
True if this duration represents a backward passage through time. False otherwise

year

public int year()
Retrieves the number of years within the duration of time stored

Returns:
Number of years within the duration of time stored

month

public int month()
Retrieves the number of months within the duration of time stored

Returns:
Number of months within the duration of time stored

string_value

public java.lang.String string_value()
Retrieves a String representation of the duration of time stored

Specified by:
string_value in class AnyType
Returns:
String representation of the duration of time stored

string_type

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

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

value

public int value()
Retrieves the duration of time stored as the number of months within it

Returns:
Number of months making up this duration of time

eq

public boolean eq(AnyType arg)
           throws DynamicError
Equality comparison between this and the supplied duration of time.

Specified by:
eq in interface CmpEq
Parameters:
arg - The duration of time to compare with
Returns:
True if they both represent the duration of time. False otherwise
Throws:
DynamicError

lt

public boolean lt(AnyType arg)
           throws DynamicError
Comparison between this and the supplied duration of time.

Specified by:
lt in interface CmpLt
Parameters:
arg - The duration of time to compare with
Returns:
True if the supplied time represents a larger duration than that stored. False otherwise
Throws:
DynamicError

gt

public boolean gt(AnyType arg)
           throws DynamicError
Comparison between this and the supplied duration of time.

Specified by:
gt in interface CmpGt
Parameters:
arg - The duration of time to compare with
Returns:
True if the supplied time represents a smaller duration than that stored. False otherwise
Throws:
DynamicError

plus

public ResultSequence plus(ResultSequence arg)
                    throws DynamicError
Mathematical addition between this duration stored and the supplied duration of time (of type XDTYearMonthDuration)

Specified by:
plus in interface MathPlus
Parameters:
arg - The duration of time to add
Returns:
New XDTYearMonthDuration representing the resulting duration after the addition
Throws:
DynamicError

minus

public ResultSequence minus(ResultSequence arg)
                     throws DynamicError
Mathematical subtraction between this duration stored and the supplied duration of time (of type XDTYearMonthDuration)

Specified by:
minus in interface MathMinus
Parameters:
arg - The duration of time to subtract
Returns:
New XDTYearMonthDuration representing the resulting duration after the subtraction
Throws:
DynamicError

times

public ResultSequence times(ResultSequence arg)
                     throws DynamicError
Mathematical multiplication between this duration stored and the supplied duration of time (of type XDTYearMonthDuration)

Specified by:
times in interface MathTimes
Parameters:
arg - The duration of time to multiply by
Returns:
New XDTYearMonthDuration representing the resulting duration after the multiplication
Throws:
DynamicError

div

public ResultSequence div(ResultSequence arg)
                   throws DynamicError
Mathematical division between this duration stored and the supplied duration of time (of type XDTYearMonthDuration)

Specified by:
div in interface MathDiv
Parameters:
arg - The duration of time to divide by
Returns:
New XDTYearMonthDuration representing the resulting duration after the division
Throws:
DynamicError