com.thaiopensource.datatype.xsd
Class DurationDatatype
java.lang.Object
com.thaiopensource.datatype.xsd.DatatypeBase
com.thaiopensource.datatype.xsd.TokenDatatype
com.thaiopensource.datatype.xsd.RegexDatatype
com.thaiopensource.datatype.xsd.DurationDatatype
- All Implemented Interfaces:
- Datatype2, Measure, OrderRelation, Datatype
class DurationDatatype
- extends RegexDatatype
- implements OrderRelation
Method Summary |
private static BigInteger |
computeDays(BigInteger months,
int refYear,
int refMonth)
Returns the number of days spanned by a period of months starting with a particular
reference year and month. |
private static BigInteger |
computeMonths(DurationDatatype.Duration d)
Returns the total number of months specified by the year and month fields of the duration |
private static BigDecimal |
computeSeconds(DurationDatatype.Duration d)
Returns the total number of seconds specified by the days, hours, minuts and seconds fields of
the duration. |
private static int |
daysInMonth(int year,
int month)
|
private static BigDecimal |
daysPlusSeconds(BigInteger days,
BigDecimal seconds)
Returns the total number of seconds from a specified number of days and seconds. |
private static BigDecimal |
getDecimalField(String str,
char code)
|
private static BigInteger |
getIntegerField(String str,
char code)
|
(package private) OrderRelation |
getOrderRelation()
|
(package private) Object |
getValue(String str,
ValidationContext vc)
|
private static boolean |
isLeapYear(int year)
|
boolean |
isLessThan(Object obj1,
Object obj2)
|
boolean |
lexicallyAllows(String str)
|
static void |
main(String[] args)
|
Methods inherited from class com.thaiopensource.datatype.xsd.DatatypeBase |
allowsValue, 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 |
PATTERN
private static final String PATTERN
- See Also:
- Constant Field Values
REF_YEAR_MONTHS
private static final int[] REF_YEAR_MONTHS
DurationDatatype
DurationDatatype()
lexicallyAllows
public boolean lexicallyAllows(String str)
- Overrides:
lexicallyAllows
in class RegexDatatype
getValue
Object getValue(String str,
ValidationContext vc)
- Overrides:
getValue
in class TokenDatatype
getIntegerField
private static BigInteger getIntegerField(String str,
char code)
getDecimalField
private static BigDecimal getDecimalField(String str,
char code)
getOrderRelation
OrderRelation getOrderRelation()
- Overrides:
getOrderRelation
in class DatatypeBase
isLessThan
public boolean isLessThan(Object obj1,
Object obj2)
- Specified by:
isLessThan
in interface OrderRelation
computeDays
private static BigInteger computeDays(BigInteger months,
int refYear,
int refMonth)
- Returns the number of days spanned by a period of months starting with a particular
reference year and month.
daysInMonth
private static int daysInMonth(int year,
int month)
isLeapYear
private static boolean isLeapYear(int year)
daysPlusSeconds
private static BigDecimal daysPlusSeconds(BigInteger days,
BigDecimal seconds)
- Returns the total number of seconds from a specified number of days and seconds.
computeMonths
private static BigInteger computeMonths(DurationDatatype.Duration d)
- Returns the total number of months specified by the year and month fields of the duration
computeSeconds
private static BigDecimal computeSeconds(DurationDatatype.Duration d)
- Returns the total number of seconds specified by the days, hours, minuts and seconds fields of
the duration.
main
public static void main(String[] args)