Java Code Examples for javax.xml.datatype.DatatypeConstants#FEBRUARY
The following examples show how to use
javax.xml.datatype.DatatypeConstants#FEBRUARY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static int maximumDayInMonthFor(int year, int month) { if (month != DatatypeConstants.FEBRUARY) { return daysInMonth[month]; } else { if (((year % 400) == 0) || (((year % 100) != 0) && ((year % 4) == 0))) { // is a leap year. return 29; } else { return daysInMonth[DatatypeConstants.FEBRUARY]; } } }
Example 2
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static int maximumDayInMonthFor(int year, int month) { if (month != DatatypeConstants.FEBRUARY) { return DaysInMonth.table[month]; } else { if (((year % 400) == 0) || (((year % 100) != 0) && ((year % 4) == 0))) { // is a leap year. return 29; } else { return DaysInMonth.table[DatatypeConstants.FEBRUARY]; } } }
Example 3
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static int maximumDayInMonthFor(int year, int month) { if (month != DatatypeConstants.FEBRUARY) { return daysInMonth[month]; } else { if (((year % 400) == 0) || (((year % 100) != 0) && ((year % 4) == 0))) { // is a leap year. return 29; } else { return daysInMonth[DatatypeConstants.FEBRUARY]; } } }
Example 4
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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]; } } }
Example 5
Source File: XMLGregorianCalendarImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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]; } } }
Example 6
Source File: XMLGregorianCalendarImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
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]; } } }
Example 7
Source File: XMLGregorianCalendarImpl.java From JDKSourceCode1.8 with MIT License | 5 votes |
private static int maximumDayInMonthFor(int year, int month) { if (month != DatatypeConstants.FEBRUARY) { return daysInMonth[month]; } else { if (((year % 400) == 0) || (((year % 100) != 0) && ((year % 4) == 0))) { // is a leap year. return 29; } else { return daysInMonth[DatatypeConstants.FEBRUARY]; } } }
Example 8
Source File: XMLGregorianCalendarImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static int maximumDayInMonthFor(int year, int month) { if (month != DatatypeConstants.FEBRUARY) { return daysInMonth[month]; } else { if (((year % 400) == 0) || (((year % 100) != 0) && ((year % 4) == 0))) { // is a leap year. return 29; } else { return daysInMonth[DatatypeConstants.FEBRUARY]; } } }
Example 9
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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]; } } }
Example 10
Source File: XMLGregorianCalendarImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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]; } } }
Example 11
Source File: XMLGregorianCalendarImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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]; } } }
Example 12
Source File: XMLGregorianCalendarImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static int maximumDayInMonthFor(int year, int month) { if (month != DatatypeConstants.FEBRUARY) { return daysInMonth[month]; } else { if (((year % 400) == 0) || (((year % 100) != 0) && ((year % 4) == 0))) { // is a leap year. return 29; } else { return daysInMonth[DatatypeConstants.FEBRUARY]; } } }
Example 13
Source File: XMLGregorianCalendarImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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]; } } }
Example 14
Source File: XMLGregorianCalendarImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static int maximumDayInMonthFor(int year, int month) { if (month != DatatypeConstants.FEBRUARY) { return daysInMonth[month]; } else { if (((year % 400) == 0) || (((year % 100) != 0) && ((year % 4) == 0))) { // is a leap year. return 29; } else { return daysInMonth[DatatypeConstants.FEBRUARY]; } } }
Example 15
Source File: XMLGregorianCalendarImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
private static int maximumDayInMonthFor(int year, int month) { if (month != DatatypeConstants.FEBRUARY) { return daysInMonth[month]; } else { if (((year % 400) == 0) || (((year % 100) != 0) && ((year % 4) == 0))) { // is a leap year. return 29; } else { return daysInMonth[DatatypeConstants.FEBRUARY]; } } }
Example 16
Source File: XMLGregorianCalendarImpl.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * 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; }
Example 17
Source File: XMLGregorianCalendarImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example 18
Source File: FEELXMLGregorianCalendar.java From jdmn with Apache License 2.0 | 4 votes |
@Override public boolean isValid() { // 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 || 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. return year != 0; } else { BigInteger yearField = getEonAndYear(); if (yearField != null) { int result = compareField(yearField, BigInteger.ZERO); return result != DatatypeConstants.EQUAL; } } return true; }
Example 19
Source File: XMLGregorianCalendarImpl.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example 20
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * 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; }