本文整理匯總了Java中javax.xml.datatype.DatatypeConstants.FEBRUARY屬性的典型用法代碼示例。如果您正苦於以下問題:Java DatatypeConstants.FEBRUARY屬性的具體用法?Java DatatypeConstants.FEBRUARY怎麽用?Java DatatypeConstants.FEBRUARY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.xml.datatype.DatatypeConstants
的用法示例。
在下文中一共展示了DatatypeConstants.FEBRUARY屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: maximumDayInMonthFor
private static int maximumDayInMonthFor(BigInteger year, int month) {
if (month != DatatypeConstants.FEBRUARY) {
return daysInMonth[month];
} else {
if (year.mod(FOUR_HUNDRED).equals(BigInteger.ZERO) ||
(!year.mod(HUNDRED).equals(BigInteger.ZERO) &&
year.mod(FOUR).equals(BigInteger.ZERO))) {
// is a leap year.
return 29;
} else {
return daysInMonth[month];
}
}
}
示例2: maximumDayInMonthFor
private static int maximumDayInMonthFor(BigInteger year, int month) {
if (month != DatatypeConstants.FEBRUARY) {
return DaysInMonth.table[month];
} else {
if (year.mod(FOUR_HUNDRED).equals(BigInteger.ZERO) ||
(!year.mod(HUNDRED).equals(BigInteger.ZERO) &&
year.mod(FOUR).equals(BigInteger.ZERO))) {
// is a leap year.
return 29;
} else {
return DaysInMonth.table[month];
}
}
}
示例3: isValid
/**
* Validate instance by <code>getXMLSchemaType()</code> constraints.
* @return true if data values are valid.
*/
public boolean isValid() {
// since setters do not allow for invalid values,
// (except for exceptional case of year field of zero),
// no need to check for anything except for constraints
// between fields.
//check if days in month is valid. Can be dependent on leap year.
if (getMonth() == DatatypeConstants.FEBRUARY) {
// years could not be set
int maxDays = 29;
if (eon == null) {
if(year!=DatatypeConstants.FIELD_UNDEFINED)
maxDays = maximumDayInMonthFor(year,getMonth());
} else {
BigInteger years = getEonAndYear();
if (years != null) {
maxDays = maximumDayInMonthFor(getEonAndYear(), DatatypeConstants.FEBRUARY);
}
}
if (getDay() > maxDays) {
return false;
}
}
// http://www.w3.org/2001/05/xmlschema-errata#e2-45
if (getHour() == 24) {
if(getMinute() != 0) {
return false;
} else if (getSecond() != 0) {
return false;
}
}
// XML Schema 1.0 specification defines year value of zero as
// invalid. Allow this class to set year field to zero
// since XML Schema 1.0 errata states that lexical zero will
// be allowed in next version and treated as 1 B.C.E.
if (eon == null) {
// optimize check.
if (year == 0) {
return false;
}
} else {
BigInteger yearField = getEonAndYear();
if (yearField != null) {
int result = compareField(yearField, BigInteger.ZERO);
if (result == DatatypeConstants.EQUAL) {
return false;
}
}
}
return true;
}