com.thaiopensource.datatype.xsd
Class DateTimeDatatype

java.lang.Object
  extended by com.thaiopensource.datatype.xsd.DatatypeBase
      extended by com.thaiopensource.datatype.xsd.TokenDatatype
          extended by com.thaiopensource.datatype.xsd.RegexDatatype
              extended by com.thaiopensource.datatype.xsd.DateTimeDatatype
All Implemented Interfaces:
Datatype2, Measure, OrderRelation, Datatype

 class DateTimeDatatype
extends RegexDatatype
implements OrderRelation


Nested Class Summary
(package private) static class DateTimeDatatype.CalendarFactory
           
private static class DateTimeDatatype.DateTime
           
 
Field Summary
private static String DAY_OF_MONTH_PATTERN
           
private static String MONTH_PATTERN
           
private  String template
           
private static String TIME_PATTERN
           
private static int TIME_ZONE_MAX
           
private static String TZ_PATTERN
           
private static String YEAR_PATTERN
           
 
Fields inherited from class com.thaiopensource.datatype.xsd.DatatypeBase
WHITE_SPACE_COLLAPSE, WHITE_SPACE_PRESERVE, WHITE_SPACE_REPLACE
 
Fields inherited from interface org.relaxng.datatype.Datatype
ID_TYPE_ID, ID_TYPE_IDREF, ID_TYPE_IDREFS, ID_TYPE_NULL
 
Constructor Summary
DateTimeDatatype(String template)
          The argument specifies the lexical representation accepted: Y specifies a year with optional preceding minus M specifies a two digit month D specifies a two digit day of month t specifies a time (hh:mm:ss.sss) any other character stands for itself.
 
Method Summary
(package private)  boolean allowsValue(String str, ValidationContext vc)
           
private static void checkDate(boolean isLeapYear, int month, int day)
           
private static Date createDate(GregorianCalendar cal, int tzOffset, boolean negative, int year, int month, int day, int hours, int minutes, int seconds, int milliseconds)
           
(package private)  OrderRelation getOrderRelation()
           
(package private)  Object getValue(String str, ValidationContext vc)
           
private static boolean isLessThan(long t1, int leapMillis1, long t2, int leapMillis2)
           
 boolean isLessThan(Object obj1, Object obj2)
           
private static String makePattern(String template)
           
private static int parse2Digits(String str, int i)
           
private static int parseTimeZone(String str, int i)
           
private static int skipDigits(String str, int i)
           
 
Methods inherited from class com.thaiopensource.datatype.xsd.RegexDatatype
alwaysValid, compile, lexicallyAllows
 
Methods inherited from class com.thaiopensource.datatype.xsd.TokenDatatype
getLength, getMeasure
 
Methods inherited from class com.thaiopensource.datatype.xsd.DatatypeBase
checkValid, createStreamingValidator, createValue, getIdType, getPrimitive, getWhiteSpace, isContextDependent, isValid, normalizeWhiteSpace, sameValue, valueHashCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

YEAR_PATTERN

private static final String YEAR_PATTERN
See Also:
Constant Field Values

MONTH_PATTERN

private static final String MONTH_PATTERN
See Also:
Constant Field Values

DAY_OF_MONTH_PATTERN

private static final String DAY_OF_MONTH_PATTERN
See Also:
Constant Field Values

TIME_PATTERN

private static final String TIME_PATTERN
See Also:
Constant Field Values

TZ_PATTERN

private static final String TZ_PATTERN
See Also:
Constant Field Values

template

private final String template

TIME_ZONE_MAX

private static final int TIME_ZONE_MAX
See Also:
Constant Field Values
Constructor Detail

DateTimeDatatype

DateTimeDatatype(String template)
The argument specifies the lexical representation accepted: Y specifies a year with optional preceding minus M specifies a two digit month D specifies a two digit day of month t specifies a time (hh:mm:ss.sss) any other character stands for itself. All lexical representations are implicitly followed by an optional time zone.

Method Detail

makePattern

private static String makePattern(String template)

allowsValue

boolean allowsValue(String str,
                    ValidationContext vc)
Overrides:
allowsValue in class DatatypeBase

getValue

Object getValue(String str,
                ValidationContext vc)
Overrides:
getValue in class TokenDatatype

createDate

private static Date createDate(GregorianCalendar cal,
                               int tzOffset,
                               boolean negative,
                               int year,
                               int month,
                               int day,
                               int hours,
                               int minutes,
                               int seconds,
                               int milliseconds)

checkDate

private static void checkDate(boolean isLeapYear,
                              int month,
                              int day)

parseTimeZone

private static int parseTimeZone(String str,
                                 int i)

parse2Digits

private static int parse2Digits(String str,
                                int i)

skipDigits

private static int skipDigits(String str,
                              int i)

getOrderRelation

OrderRelation getOrderRelation()
Overrides:
getOrderRelation in class DatatypeBase

isLessThan

public boolean isLessThan(Object obj1,
                          Object obj2)
Specified by:
isLessThan in interface OrderRelation

isLessThan

private static boolean isLessThan(long t1,
                                  int leapMillis1,
                                  long t2,
                                  int leapMillis2)