org.ucl.xpath.types
Class XDTDayTimeDuration

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.XDTDayTimeDuration
All Implemented Interfaces:
java.lang.Cloneable, CmpEq, CmpGt, CmpLt, MathDiv, MathMinus, MathPlus, MathTimes

public class XDTDayTimeDuration
extends XSDuration
implements CmpEq, CmpLt, CmpGt, MathPlus, MathMinus, MathTimes, MathDiv, java.lang.Cloneable

A representation of the DayTimeDuration datatype


Constructor Summary
XDTDayTimeDuration()
          Initialises to a duration of no time (0days, 0hours, 0minutes, 0seconds)
XDTDayTimeDuration(double secs)
          Initialises to the given number of seconds
XDTDayTimeDuration(int days, int hours, int minutes, double seconds, boolean negative)
          Initialises to the supplied parameters.
 
Method Summary
 java.lang.Object clone()
          Creates a copy of this representation of a time duration
 ResultSequence constructor(ResultSequence arg)
          Creates a new ResultSequence consisting of the extractable time duration from the supplied ResultSequence
 int days()
          Retrieves the number of days within the duration of time stored
 ResultSequence div(ResultSequence arg)
          Mathematical division between this duration stored and the supplied duration of time (of type XDTDayTimeDuration)
 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.
 int hours()
          Retrieves the number of hours (max 24) within the duration of time stored
 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 XDTDayTimeDuration)
 int minutes()
          Retrieves the number of minutes (max 60) within the duration of time stored
 boolean negative()
          Retrieves whether this duration represents a backward passage through time
static XDTDayTimeDuration parseDTDuration(java.lang.String str)
          Creates a new XDTDayTimeDuration 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 XDTDayTimeDuration)
 double seconds()
          Retrieves the number of seconds (max 60) within the duration of time stored
 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 XDTDayTimeDuration)
 java.lang.String type_name()
          Retrives the datatype's name
 double value()
          Retrieves the duration of time stored as the number of seconds within it
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XDTDayTimeDuration

public XDTDayTimeDuration(int days,
                          int hours,
                          int minutes,
                          double seconds,
                          boolean negative)
Initialises to the supplied parameters. If more than 24 hours is supplied, the number of days is adjusted acordingly. The same occurs for minutes and seconds

Parameters:
days - Number of days in this duration of time
hours - Number of hours in this duration of time
minutes - Number of minutes in this duration of time
seconds - Number of seconds in this duration of time
negative - True if this duration of time represents a backwards passage through time. False otherwise

XDTDayTimeDuration

public XDTDayTimeDuration(double secs)
Initialises to the given number of seconds

Parameters:
secs - Number of seconds in the duration of time

XDTDayTimeDuration

public XDTDayTimeDuration()
Initialises to a duration of no time (0days, 0hours, 0minutes, 0seconds)

Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates a copy of this representation of a time duration

Returns:
New XDTDayTimeDuration representing the duration of time stored
Throws:
java.lang.CloneNotSupportedException

parseDTDuration

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

Parameters:
str - String represented duration of time
Returns:
New XDTDayTimeDuration 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:
"dayTimeDuration" 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

days

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

Returns:
Number of days within the duration of time stored

minutes

public int minutes()
Retrieves the number of minutes (max 60) within the duration of time stored

Returns:
Number of minutes within the duration of time stored

hours

public int hours()
Retrieves the number of hours (max 24) within the duration of time stored

Returns:
Number of hours within the duration of time stored

seconds

public double seconds()
Retrieves the number of seconds (max 60) within the duration of time stored

Returns:
Number of seconds 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:dayTimeDuration" which is the datatype's full pathname

value

public double value()
Retrieves the duration of time stored as the number of seconds within it

Returns:
Number of seconds 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 XDTDayTimeDuration)

Specified by:
plus in interface MathPlus
Parameters:
arg - The duration of time to add
Returns:
New XDTDayTimeDuration 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 XDTDayTimeDuration)

Specified by:
minus in interface MathMinus
Parameters:
arg - The duration of time to subtract
Returns:
New XDTDayTimeDuration 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 XDTDayTimeDuration)

Specified by:
times in interface MathTimes
Parameters:
arg - The duration of time to multiply by
Returns:
New XDTDayTimeDuration 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 XDTDayTimeDuration)

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