Package org.eclipse.wst.xml.xpath2.processor.internal.types


org.eclipse.wst.xml.xpath2.processor.internal.types
Class XSDateTime



public class XSDateTime
extends org.eclipse.wst.xml.xpath2.processor.internal.types.CalendarType
A representation of a date and time (and optional timezone)

Constructor Summary

XSDateTime(java.util.Calendar cal , org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration tz)
XSDateTime()

Method Summary

public java.util.Calendarcalendar()
     Retrieves the Calendar representation of the date stored
public java.lang.Objectclone()
     Creates a copy of this date and time representation
public org.eclipse.wst.xml.xpath2.api.ResultSequenceconstructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg)
     Creates a new result sequence consisting of the retrievable date and time value in the supplied result sequence
public intday()
     Retrieve the day from the date stored
public booleaneq(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType arg , org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext)
     Equality comparison on this and the supplied dates and times (taking timezones into account)
public java.lang.StringgetStringValue()
     Retrieves a String representation of the date and time stored
public org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinitiongetTypeDefinition()
    
public booleangt(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType arg , org.eclipse.wst.xml.xpath2.api.DynamicContext context)
     Comparison on this and the supplied dates and times (taking timezones into account)
public inthour()
     Retrieve the hour from the date stored
public static booleanis_digit(char x)
     Check to see if a character is numeric
public booleanlt(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType arg , org.eclipse.wst.xml.xpath2.api.DynamicContext context)
     Comparison on this and the supplied dates and times (taking timezones into account)
public org.eclipse.wst.xml.xpath2.api.ResultSequenceminus(org.eclipse.wst.xml.xpath2.api.ResultSequence arg)
     Mathematical minus operator between this XSDateTime and a supplied result sequence (XSDateTime, XDTYearMonthDuration and XDTDayTimeDuration are only valid ones).
public intminute()
     Retrieve the minute from the date stored
public intmonth()
     Retrieve the month from the date stored
public static java.lang.Stringpad_int(int num , int len)
     Pads the supplied number to the supplied number of digits by adding 0's in front of it
public static int[]parse_date(java.lang.String str)
     Parses a String representation of a date and time and retrieves the year, month and day from it
public static double[]parse_time(java.lang.String str)
     Parses a String representation of a date and time and retrieves the hour, minute and seconds from it
public static int[]parse_timezone(java.lang.String str)
     Parses a String representation of a date and time and retrieves the timezone from it
public static org.eclipse.wst.xml.xpath2.processor.internal.types.XSDateTimeparseDateTime(java.lang.String str)
     Parses a String representation of a date and time and constructs a new XSDateTime object using that information
public org.eclipse.wst.xml.xpath2.api.ResultSequenceplus(org.eclipse.wst.xml.xpath2.api.ResultSequence arg)
     Mathematical addition operator between this XSDateTime and a supplied result sequence (XDTYearMonthDuration and XDTDayTimeDuration are only valid ones).
public doublesecond()
     Retrieve the seconds from the date stored
public java.lang.Stringstring_type()
     Retrive the datatype full pathname
public booleantimezoned()
    
public java.lang.Stringtype_name()
     Retrieves the datatype name
public org.eclipse.wst.xml.xpath2.processor.internal.types.XSDurationtz()
     Retrieves the timezone associated with the date stored
public doublevalue()
     Currently unsupported method. Retrieves the date in milliseconds since the begining of epoch
public intyear()
     Retrieve the year from the date stored

Constructor Detail

XSDateTime

public XSDateTime(java.util.Calendar cal , org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration tz)

Initiates a new representation of a supplied date and time


XSDateTime

public XSDateTime()

Inititates a new representation of the current date and time


Methods Detail

calendar

public java.util.Calendar calendar()

Retrieves the Calendar representation of the date stored

Returns

java.util.Calendar - Calendar representation of the date stored


clone

public java.lang.Object clone()

Creates a copy of this date and time representation

Returns

java.lang.Object - A copy of this date and time representation

Throws:

java.lang.CloneNotSupportedException


constructor

public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg)

Creates a new result sequence consisting of the retrievable date and time value in the supplied result sequence

Parameters

arg - The result sequence from which to extract the date and time value.

Returns

org.eclipse.wst.xml.xpath2.api.ResultSequence - A new result sequence consisting of the date and time value supplied.

Throws:

org.eclipse.wst.xml.xpath2.processor.DynamicError


day

public int day()

Retrieve the day from the date stored

Returns

int - the day value of the date stored


eq

public boolean eq(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType arg , org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext)

Equality comparison on this and the supplied dates and times (taking timezones into account)

Parameters

arg - XSDateTime representation of the date to compare to

dynamicContext

Returns

boolean - True if the two dates and times are represent the same exact point in time. False otherwise.

Throws:

org.eclipse.wst.xml.xpath2.processor.DynamicError


getStringValue

public java.lang.String getStringValue()

Retrieves a String representation of the date and time stored

Returns

java.lang.String - String representation of the date and time stored


getTypeDefinition

public org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition getTypeDefinition()

Returns

org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition


gt

public boolean gt(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType arg , org.eclipse.wst.xml.xpath2.api.DynamicContext context)

Comparison on this and the supplied dates and times (taking timezones into account)

Parameters

arg - XSDateTime representation of the date to compare to

context

Returns

boolean - True if in time, this date and time lies after the date and time supplied. False otherwise.

Throws:

org.eclipse.wst.xml.xpath2.processor.DynamicError


hour

public int hour()

Retrieve the hour from the date stored

Returns

int - the hour value of the date stored


is_digit

public boolean is_digit(char x)

Check to see if a character is numeric

Parameters

x - Character to be tested

Returns

boolean - True if the character is numeric. False otherwise.


lt

public boolean lt(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType arg , org.eclipse.wst.xml.xpath2.api.DynamicContext context)

Comparison on this and the supplied dates and times (taking timezones into account)

Parameters

arg - XSDateTime representation of the date to compare to

context

Returns

boolean - True if in time, this date and time lies before the date and time supplied. False otherwise.

Throws:

org.eclipse.wst.xml.xpath2.processor.DynamicError


minus

public org.eclipse.wst.xml.xpath2.api.ResultSequence minus(org.eclipse.wst.xml.xpath2.api.ResultSequence arg)

Mathematical minus operator between this XSDateTime and a supplied result sequence (XSDateTime, XDTYearMonthDuration and XDTDayTimeDuration are only valid ones).

Parameters

arg - The supplied ResultSequence that is on the right of the minus operator. If this is an XSDateTime, the result will be a XDTDayTimeDuration of the duration of time between these two dates. If arg is an XDTYearMonthDuration or an XDTDayTimeDuration the result will be a XSDateTime of the result of the current date minus the duration of time supplied.

Returns

org.eclipse.wst.xml.xpath2.api.ResultSequence - New ResultSequence consisting of the result of the mathematical minus operation.

Throws:

org.eclipse.wst.xml.xpath2.processor.DynamicError


minute

public int minute()

Retrieve the minute from the date stored

Returns

int - the minute value of the date stored


month

public int month()

Retrieve the month from the date stored

Returns

int - the month value of the date stored


pad_int

public java.lang.String pad_int(int num , int len)

Pads the supplied number to the supplied number of digits by adding 0's in front of it

Parameters

num - Number that si to be padded (if neccessay)

len - Desired length after padding

Returns

java.lang.String - String representation of the padded integer


parse_date

public int[] parse_date(java.lang.String str)

Parses a String representation of a date and time and retrieves the year, month and day from it

Parameters

str - The String representation of the date (and optional timezone)

Returns

int[] - Integer array of size 3. Element 1 is the year, element 2 is the month and element 3 is the day


parse_time

public double[] parse_time(java.lang.String str)

Parses a String representation of a date and time and retrieves the hour, minute and seconds from it

Parameters

str - The String representation of the date (and optional timezone)

Returns

double[] - Integer array of size 3. Element 1 is the hour, element 2 is the minute and element 3 is the seconds


parse_timezone

public int[] parse_timezone(java.lang.String str)

Parses a String representation of a date and time and retrieves the timezone from it

Parameters

str - The String representation of the date (and optional timezone)

Returns

int[] - Integer array of size 3. Element 1 represents whether the timezone is ahead or behind GMT, element 2 is the hour displacement and element 3 is the minute displacement.


parseDateTime

public org.eclipse.wst.xml.xpath2.processor.internal.types.XSDateTime parseDateTime(java.lang.String str)

Parses a String representation of a date and time and constructs a new XSDateTime object using that information

Parameters

str - The String representation of the date (and optional timezone)

Returns

org.eclipse.wst.xml.xpath2.processor.internal.types.XSDateTime - The XSDateTime representation of the date and time (and optional timezone)


plus

public org.eclipse.wst.xml.xpath2.api.ResultSequence plus(org.eclipse.wst.xml.xpath2.api.ResultSequence arg)

Mathematical addition operator between this XSDateTime and a supplied result sequence (XDTYearMonthDuration and XDTDayTimeDuration are only valid ones).

Parameters

arg - The supplied ResultSequence that is on the right of the minus operator. If arg is an XDTYearMonthDuration or an XDTDayTimeDuration the result will be a XSDateTime of the result of the current date minus the duration of time supplied.

Returns

org.eclipse.wst.xml.xpath2.api.ResultSequence - New ResultSequence consisting of the result of the mathematical minus operation.

Throws:

org.eclipse.wst.xml.xpath2.processor.DynamicError


second

public double second()

Retrieve the seconds from the date stored

Returns

double - the seconds value of the date stored


string_type

public java.lang.String string_type()

Retrive the datatype full pathname

Returns

java.lang.String - "xs:dateTime" which is the datatype full pathname


timezoned

public boolean timezoned()

Returns

boolean


type_name

public java.lang.String type_name()

Retrieves the datatype name

Returns

java.lang.String - "dateTime" which is the dataype name


tz

public org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration tz()

Retrieves the timezone associated with the date stored

Returns

org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration - the timezone associated with the date stored


value

public double value()

Currently unsupported method. Retrieves the date in milliseconds since the begining of epoch

Returns

double - Number of milliseconds since the begining of the epoch


year

public int year()

Retrieve the year from the date stored

Returns

int - the year value of the date stored