org.ucl.xpath.types
Class XSTime

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.CalendarType
                      extended byorg.ucl.xpath.types.XSTime
All Implemented Interfaces:
java.lang.Cloneable, CmpEq, CmpGt, CmpLt, MathMinus, MathPlus

public class XSTime
extends CalendarType
implements CmpEq, CmpLt, CmpGt, MathMinus, MathPlus, java.lang.Cloneable

A representation of the Time datatype


Constructor Summary
XSTime()
          Initialises to the current time
XSTime(java.util.Calendar cal, XDTDayTimeDuration tz)
          Initialises to the supplied time and timezone
 
Method Summary
 java.util.Calendar calendar()
          Retrieves a Calendar representation of time stored
 java.lang.Object clone()
          Creates a new copy of the time (and timezone) stored
 ResultSequence constructor(ResultSequence arg)
          Creates a new ResultSequence consisting of the extractable time from the supplied ResultSequence
 boolean eq(AnyType arg)
          Equality comparison between this and the supplied XSTime representation
 boolean gt(AnyType arg)
          Comparison between this and the supplied XSTime representation
 int hour()
          Retrieves the hour stored as an integer
 boolean lt(AnyType arg)
          Comparison between this and the supplied XSTime representation
 ResultSequence minus(ResultSequence arg)
          Mathematical subtraction between this time stored and the supplied representation.
 int minute()
          Retrieves the minute stored as an integer
static XSTime parse_time(java.lang.String str)
          Creates a new XSTime representing the String represented supplied time
 ResultSequence plus(ResultSequence arg)
          Mathematical addition between this time stored and the supplied time duration.
 double second()
          Retrieves the seconds stored as an integer
 java.lang.String string_type()
          Retrieves the datatype's full pathname
 java.lang.String string_value()
          Retrieves a String representation of the time stored
 boolean timezoned()
          Check for whether the time stored has a timezone associated with it
 java.lang.String type_name()
          Retrieves the datatype's name
 XDTDayTimeDuration tz()
          Retrieves the timezone associated with the time stored as a duration of time
 double value()
          Retrieves the time in milliseconds since the epoch
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSTime

public XSTime(java.util.Calendar cal,
              XDTDayTimeDuration tz)
Initialises to the supplied time and timezone

Parameters:
cal - Calendar representation of the time to be stored
tz - The timezone (possibly null) associated with this time

XSTime

public XSTime()
Initialises to the current time

Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates a new copy of the time (and timezone) stored

Returns:
New XSTime representing the copy of the time and timezone
Throws:
java.lang.CloneNotSupportedException

type_name

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

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

parse_time

public static XSTime parse_time(java.lang.String str)
Creates a new XSTime representing the String represented supplied time

Parameters:
str - String represented time and timezone to be stored
Returns:
New XSTime representing the supplied time

constructor

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

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

hour

public int hour()
Retrieves the hour stored as an integer

Returns:
The hour stored

minute

public int minute()
Retrieves the minute stored as an integer

Returns:
The minute stored

second

public double second()
Retrieves the seconds stored as an integer

Returns:
The second stored

timezoned

public boolean timezoned()
Check for whether the time stored has a timezone associated with it

Returns:
True if the time has a timezone associated. False otherwise

string_value

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

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

string_type

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

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

calendar

public java.util.Calendar calendar()
Retrieves a Calendar representation of time stored

Returns:
Calendar representation of the time stored

tz

public XDTDayTimeDuration tz()
Retrieves the timezone associated with the time stored as a duration of time

Returns:
The duration of time between the time stored and the actual time after the timezone is taken into account

value

public double value()
Retrieves the time in milliseconds since the epoch

Returns:
time stored in milliseconds since the epoch

eq

public boolean eq(AnyType arg)
           throws DynamicError
Equality comparison between this and the supplied XSTime representation

Specified by:
eq in interface CmpEq
Parameters:
arg - The XSTime to compare with
Returns:
True if both XSTime's represent the same time. False otherwise
Throws:
DynamicError

lt

public boolean lt(AnyType arg)
           throws DynamicError
Comparison between this and the supplied XSTime representation

Specified by:
lt in interface CmpLt
Parameters:
arg - The XSTime to compare with
Returns:
True if the supplied time represnts a point in time after that represented by the time stored. False otherwise
Throws:
DynamicError - Dynamic error.

gt

public boolean gt(AnyType arg)
           throws DynamicError
Comparison between this and the supplied XSTime representation

Specified by:
gt in interface CmpGt
Parameters:
arg - The XSTime to compare with
Returns:
True if the supplied time represnts a point in time before that represented by the time stored. False otherwise
Throws:
DynamicError

minus

public ResultSequence minus(ResultSequence arg)
                     throws DynamicError
Mathematical subtraction between this time stored and the supplied representation. This supplied representation must be of either type XSTime (in which case the result is the duration of time between these two times) or a XDTDayTimeDuration (in which case the result is the time when this duration is subtracted from the time stored).

Specified by:
minus in interface MathMinus
Parameters:
arg - The representation to subtract (either XSTim or XDTDayTimeDuration)
Returns:
A ResultSequence representing the result of the subtraction
Throws:
DynamicError - Dynamic error.

plus

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

Specified by:
plus in interface MathPlus
Parameters:
arg - A XDTDayTimeDuration representation of the duration of time to add
Returns:
A XSTime representing the result of this addition.
Throws:
DynamicError