public abstract class

AbstractDateTimeDV

extends TypeValidator
java.lang.Object
   ↳ org.apache.xerces.impl.dv.xs.TypeValidator
     ↳ org.apache.xerces.impl.dv.xs.AbstractDateTimeDV
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

This is the base class of all date/time datatype validators. It implements common code for parsing, validating and comparing datatypes. Classes that extend this class, must implement parse() method. REVISIT: There are many instance variables, which would cause problems when we support grammar caching. A grammar is possibly used by two parser instances at the same time, then the same simple type decl object can be used to validate two strings at the same time. -SG

Summary

Constants
int DAY
int MONTH
int YEAR
[Expand]
Inherited Constants
From class org.apache.xerces.impl.dv.xs.TypeValidator
Fields
protected DatatypeFactory factory
Public Constructors
AbstractDateTimeDV()
Public Methods
int compare(Object value1, Object value2)
short getAllowedFacets()
boolean isIdentical(Object value1, Object value2)
Protected Methods
void append(StringBuffer message, int value, int nch)
void append(StringBuffer message, double value)
short compareDates(AbstractDateTimeDV.DateTimeData date1, AbstractDateTimeDV.DateTimeData date2, boolean strict)
Compare algorithm described in dateDime (3.2.7).
short compareOrder(AbstractDateTimeDV.DateTimeData date1, AbstractDateTimeDV.DateTimeData date2)
Given normalized values, determines order-relation between give date/time objects.
String dateToString(AbstractDateTimeDV.DateTimeData date)
int fQuotient(int temp, int low, int high)
int fQuotient(int a, int b)
int findUTCSign(String buffer, int start, int end)
Return index of UTC char: 'Z', '+', '-'
int getDate(String buffer, int start, int end, AbstractDateTimeDV.DateTimeData date)
Parses date CCYY-MM-DD
Duration getDuration(AbstractDateTimeDV.DateTimeData data)
void getTime(String buffer, int start, int end, AbstractDateTimeDV.DateTimeData data)
Parses time hh:mm:ss.sss and time zone if any
void getTimeZone(String buffer, AbstractDateTimeDV.DateTimeData data, int sign, int end)
Parses time zone: 'Z' or {+,-} followed by hh:mm
XMLGregorianCalendar getXMLGregorianCalendar(AbstractDateTimeDV.DateTimeData data)
int getYearMonth(String buffer, int start, int end, AbstractDateTimeDV.DateTimeData date)
Parses date CCYY-MM
int indexOf(String buffer, int start, int end, char ch)
Computes index of given char within StringBuffer
final boolean isNextCharUTCSign(String buffer, int start, int end)
Returns true if the character at start is 'Z', '+' or '-'.
int maxDayInMonthFor(int year, int month)
Given {year,month} computes maximum number of days for given month
int mod(int a, int b, int quotient)
int modulo(int temp, int low, int high)
void normalize(AbstractDateTimeDV.DateTimeData date)
If timezone present - normalize dateTime [E Adding durations to dateTimes]
int parseInt(String buffer, int start, int end)
Given start and end position, parses string value
int parseIntYear(String buffer, int end)
double parseSecond(String buffer, int start, int end)
void parseTimeZone(String buffer, int start, int end, AbstractDateTimeDV.DateTimeData date)
Shared code from Date and YearMonth datatypes.
void resetDateObj(AbstractDateTimeDV.DateTimeData data)
Resets object representation of date/time
void saveUnnormalized(AbstractDateTimeDV.DateTimeData date)
void validateDateTime(AbstractDateTimeDV.DateTimeData data)
Validates given date/time object accoring to W3C PR Schema [D.1 ISO 8601 Conventions]
[Expand]
Inherited Methods
From class org.apache.xerces.impl.dv.xs.TypeValidator
From class java.lang.Object

Constants

protected static final int DAY

Constant Value: 1 (0x00000001)

protected static final int MONTH

Constant Value: 1 (0x00000001)

protected static final int YEAR

Constant Value: 2000 (0x000007d0)

Fields

protected DatatypeFactory factory

Public Constructors

public AbstractDateTimeDV ()

Public Methods

public int compare (Object value1, Object value2)

public short getAllowedFacets ()

public boolean isIdentical (Object value1, Object value2)

Protected Methods

protected void append (StringBuffer message, int value, int nch)

protected void append (StringBuffer message, double value)

protected short compareDates (AbstractDateTimeDV.DateTimeData date1, AbstractDateTimeDV.DateTimeData date2, boolean strict)

Compare algorithm described in dateDime (3.2.7). Duration datatype overwrites this method

Parameters
date1 normalized date representation of the first value
date2 normalized date representation of the second value
Returns
  • less, greater, less_equal, greater_equal, equal

protected short compareOrder (AbstractDateTimeDV.DateTimeData date1, AbstractDateTimeDV.DateTimeData 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

protected String dateToString (AbstractDateTimeDV.DateTimeData date)

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

protected int fQuotient (int a, int b)

protected int findUTCSign (String buffer, int start, int end)

Return index of UTC char: 'Z', '+', '-'

Returns
  • index of the UTC character that was found

protected int getDate (String buffer, int start, int end, AbstractDateTimeDV.DateTimeData date)

Parses date CCYY-MM-DD

Parameters
start start position
end end position

protected Duration getDuration (AbstractDateTimeDV.DateTimeData data)

protected void getTime (String buffer, int start, int end, AbstractDateTimeDV.DateTimeData data)

Parses time hh:mm:ss.sss and time zone if any

protected void getTimeZone (String buffer, AbstractDateTimeDV.DateTimeData data, int sign, int end)

Parses time zone: 'Z' or {+,-} followed by hh:mm

protected XMLGregorianCalendar getXMLGregorianCalendar (AbstractDateTimeDV.DateTimeData data)

protected int getYearMonth (String buffer, int start, int end, AbstractDateTimeDV.DateTimeData date)

Parses date CCYY-MM

Parameters
start start position
end end position

protected int indexOf (String buffer, int start, int end, char ch)

Computes index of given char within StringBuffer

Parameters
ch character to look for in StringBuffer
Returns
  • index of ch within StringBuffer

protected final boolean isNextCharUTCSign (String buffer, int start, int end)

Returns true if the character at start is 'Z', '+' or '-'.

protected int maxDayInMonthFor (int year, int month)

Given {year,month} computes maximum number of days for given month

Returns
  • integer containg the number of days in a given month

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

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

protected void normalize (AbstractDateTimeDV.DateTimeData date)

If timezone present - normalize dateTime [E Adding durations to dateTimes]

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

protected int parseInt (String buffer, int start, int end)

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

protected int parseIntYear (String buffer, int end)

protected double parseSecond (String buffer, int start, int end)

protected void parseTimeZone (String buffer, int start, int end, AbstractDateTimeDV.DateTimeData date)

Shared code from Date and YearMonth datatypes. Finds if time zone sign is present

protected void resetDateObj (AbstractDateTimeDV.DateTimeData data)

Resets object representation of date/time

Parameters
data date/time object

protected void saveUnnormalized (AbstractDateTimeDV.DateTimeData date)

protected void validateDateTime (AbstractDateTimeDV.DateTimeData data)

Validates given date/time object accoring to W3C PR Schema [D.1 ISO 8601 Conventions]