org.eclipse.emf.ecore.xml.type.internal
Class XMLCalendar

java.lang.Object
  extended byorg.eclipse.emf.ecore.xml.type.internal.XMLCalendar

public final class XMLCalendar
extends Object

Representation for the W3C XML Schema 1.0 dateTime, time, date, gYearMonth, gYear, gMonthDay, gDay, gMonth datatypes. NOTE: this class is for internal use only. Later this class will be replaced by JAXP 1.3 javax.xml.datatype.XMLGregorianCalendar class. This class is based on Apache Xerces2 2.6.2 parser implementation of date/time validation.


Field Summary
protected static int CY
           
protected static int D
           
static short DATE
           
static short DATETIME
           
protected static int DAY
           
protected static DateFormat[] EDATE_FORMATS
           
static int EQUALS
           
static short GDAY
           
static short GMONTH
           
static short GMONTHDAY
           
static int GREATER_THAN
           
static short GYEAR
           
static short GYEARMONTH
           
protected static int h
           
protected static int hh
           
static int INDETERMINATE
           
static int LESS_THAN
           
protected static int m
           
protected static int M
           
protected static int mm
           
protected static int MONTH
           
protected static int ms
           
protected static int msp
           
protected static int s
           
static short TIME
           
protected static int TOTAL_SIZE
           
protected static int utc
           
protected static int YEAR
           
 
Constructor Summary
XMLCalendar(Date date, short dataType)
           
XMLCalendar(String value, short datatype)
           
 
Method Summary
static int compare(XMLCalendar value1, XMLCalendar value2)
           
protected static short compareOrder(int[] date1, int[] date2)
          Given normalized values, determines order-relation between give date/time objects.
 boolean equals(Object obj)
           
protected static int fQuotient(int a, int b)
           
protected static int fQuotient(int temp, int low, int high)
           
 Date getDate()
           
protected static int getDate(String buffer, int start, int end, int[] date)
          Parses date CCYY-MM-DD
protected  int[] getDateValue()
           
protected static void getTime(String buffer, int start, int end, int[] data, int[] timeZone)
          Parses time hh:mm:ss.sss and time zone if any
protected static void getTimeZone(String buffer, int[] data, int sign, int end, int[] timeZone)
          Parses time zone: 'Z' or {+,-} followed by hh:mm
protected static int getYearMonth(String buffer, int start, int end, int[] date)
          Parses date CCYY-MM
 int hashCode()
           
protected static int indexOf(String buffer, int start, int end, char ch)
          Computes index of given char within StringBuffer
protected static int maxDayInMonthFor(int year, int month)
          Given {year,month} computes maximum number of days for given month
protected static int mod(int a, int b, int quotient)
           
protected static int modulo(int temp, int low, int high)
           
protected static void normalize(int[] date, int[] timeZone)
          If timezone present - normalize dateTime [E Adding durations to dateTimes]
protected static int parseInt(String buffer, int start, int end)
          Given start and end position, parses string value
protected static int parseIntYear(String buffer, int end)
           
protected static void parseTimeZone(String buffer, int start, int end, int[] date, int[] timeZone)
          Shared code from Date and YearMonth datatypes.
protected static void resetDateObj(int[] data)
          Resets object representation of date/time
 String toString()
           
protected static void validateDateTime(int[] data, int[] timeZone)
          Validates given date/time object accoring to W3C PR Schema [D.1 ISO 8601 Conventions]
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DATETIME

public static final short DATETIME
See Also:
Constant Field Values

TIME

public static final short TIME
See Also:
Constant Field Values

DATE

public static final short DATE
See Also:
Constant Field Values

GYEARMONTH

public static final short GYEARMONTH
See Also:
Constant Field Values

GYEAR

public static final short GYEAR
See Also:
Constant Field Values

GMONTHDAY

public static final short GMONTHDAY
See Also:
Constant Field Values

GDAY

public static final short GDAY
See Also:
Constant Field Values

GMONTH

public static final short GMONTH
See Also:
Constant Field Values

EQUALS

public static final int EQUALS
See Also:
Constant Field Values

LESS_THAN

public static final int LESS_THAN
See Also:
Constant Field Values

GREATER_THAN

public static final int GREATER_THAN
See Also:
Constant Field Values

INDETERMINATE

public static final int INDETERMINATE
See Also:
Constant Field Values

CY

protected static final int CY
See Also:
Constant Field Values

M

protected static final int M
See Also:
Constant Field Values

D

protected static final int D
See Also:
Constant Field Values

h

protected static final int h
See Also:
Constant Field Values

m

protected static final int m
See Also:
Constant Field Values

s

protected static final int s
See Also:
Constant Field Values

ms

protected static final int ms
See Also:
Constant Field Values

msp

protected static final int msp
See Also:
Constant Field Values

utc

protected static final int utc
See Also:
Constant Field Values

hh

protected static final int hh
See Also:
Constant Field Values

mm

protected static final int mm
See Also:
Constant Field Values

TOTAL_SIZE

protected static final int TOTAL_SIZE
See Also:
Constant Field Values

YEAR

protected static final int YEAR
See Also:
Constant Field Values

MONTH

protected static final int MONTH
See Also:
Constant Field Values

DAY

protected static final int DAY
See Also:
Constant Field Values

EDATE_FORMATS

protected static final DateFormat[] EDATE_FORMATS
Constructor Detail

XMLCalendar

public XMLCalendar(String value,
                   short datatype)

XMLCalendar

public XMLCalendar(Date date,
                   short dataType)
Method Detail

equals

public boolean equals(Object obj)

hashCode

public int hashCode()

toString

public String toString()

compare

public static int compare(XMLCalendar value1,
                          XMLCalendar value2)

getDateValue

protected int[] getDateValue()

getDate

public Date getDate()

compareOrder

protected static short compareOrder(int[] date1,
                                    int[] date2)
Given normalized values, determines order-relation between give date/time objects.

Parameters:
date1 - date/time object
date2 - date/time object
Returns:
0 if date1 and date2 are equal, a value less than 0 if date1 is less than date2, a value greater than 0 if date1 is greater than date2

getTime

protected static void getTime(String buffer,
                              int start,
                              int end,
                              int[] data,
                              int[] timeZone)
Parses time hh:mm:ss.sss and time zone if any


getDate

protected static int getDate(String buffer,
                             int start,
                             int end,
                             int[] date)
Parses date CCYY-MM-DD

Parameters:
start -
end -
date -

getYearMonth

protected static int getYearMonth(String buffer,
                                  int start,
                                  int end,
                                  int[] date)
Parses date CCYY-MM

Parameters:
start -
end -
date -

parseTimeZone

protected static void parseTimeZone(String buffer,
                                    int start,
                                    int end,
                                    int[] date,
                                    int[] timeZone)
Shared code from Date and YearMonth datatypes. Finds if time zone sign is present

Parameters:
end -
date -

getTimeZone

protected static void getTimeZone(String buffer,
                                  int[] data,
                                  int sign,
                                  int end,
                                  int[] timeZone)
Parses time zone: 'Z' or {+,-} followed by hh:mm

Parameters:
data -
sign -

indexOf

protected static int indexOf(String buffer,
                             int start,
                             int end,
                             char ch)
Computes index of given char within StringBuffer

Parameters:
start -
end -
ch - character to look for in StringBuffer
Returns:
index of ch within StringBuffer

validateDateTime

protected static void validateDateTime(int[] data,
                                       int[] timeZone)
Validates given date/time object accoring to W3C PR Schema [D.1 ISO 8601 Conventions]

Parameters:
data -

parseInt

protected static int parseInt(String buffer,
                              int start,
                              int end)
                       throws NumberFormatException
Given start and end position, parses string value

Parameters:
buffer - string to parse
start - Start position
end - end position
Returns:
return integer representation of characters
Throws:
NumberFormatException

parseIntYear

protected static int parseIntYear(String buffer,
                                  int end)

normalize

protected static void normalize(int[] date,
                                int[] timeZone)
If timezone present - normalize dateTime [E Adding durations to dateTimes]

Parameters:
date - CCYY-MM-DDThh:mm:ss+03
Returns:
CCYY-MM-DDThh:mm:ssZ

resetDateObj

protected static void resetDateObj(int[] data)
Resets object representation of date/time

Parameters:
data - date/time object

maxDayInMonthFor

protected static int maxDayInMonthFor(int year,
                                      int month)
Given {year,month} computes maximum number of days for given month

Parameters:
year -
month -
Returns:
integer containg the number of days in a given month

mod

protected static int mod(int a,
                         int b,
                         int quotient)

fQuotient

protected static int fQuotient(int a,
                               int b)

modulo

protected static int modulo(int temp,
                            int low,
                            int high)

fQuotient

protected static int fQuotient(int temp,
                               int low,
                               int high)

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.