Java Code Examples for javax.xml.datatype.DatatypeConstants#EQUAL
The following examples show how to use
javax.xml.datatype.DatatypeConstants#EQUAL .
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 | 6 votes |
/** * <p>Implement Step B from * http://www.w3.org/TR/xmlschema-2/#dateTime-order.</p> */ private static int compareField(int Pfield, int Qfield) { if (Pfield == Qfield) { //fields are either equal in value or both undefined. // Step B. 1.1 AND optimized result of performing 1.1-1.4. return DatatypeConstants.EQUAL; } else { if (Pfield == DatatypeConstants.FIELD_UNDEFINED || Qfield == DatatypeConstants.FIELD_UNDEFINED) { // Step B. 1.2 return DatatypeConstants.INDETERMINATE; } else { // Step B. 1.3-4. return (Pfield < Qfield ? DatatypeConstants.LESSER : DatatypeConstants.GREATER); } } }
Example 2
Source File: XMLGregorianCalendarImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * <p>Implement Step B from * http://www.w3.org/TR/xmlschema-2/#dateTime-order.</p> */ private static int compareField(int Pfield, int Qfield) { if (Pfield == Qfield) { //fields are either equal in value or both undefined. // Step B. 1.1 AND optimized result of performing 1.1-1.4. return DatatypeConstants.EQUAL; } else { if (Pfield == DatatypeConstants.FIELD_UNDEFINED || Qfield == DatatypeConstants.FIELD_UNDEFINED) { // Step B. 1.2 return DatatypeConstants.INDETERMINATE; } else { // Step B. 1.3-4. return (Pfield < Qfield ? DatatypeConstants.LESSER : DatatypeConstants.GREATER); } } }
Example 3
Source File: XMLGregorianCalendarImpl.java From Bytecoder with Apache License 2.0 | 6 votes |
private static int compareField(BigDecimal Pfield, BigDecimal Qfield) { // optimization. especially when both arguments are null. if (Pfield == Qfield) { return DatatypeConstants.EQUAL; } if (Pfield == null) { Pfield = DECIMAL_ZERO; } if (Qfield == null) { Qfield = DECIMAL_ZERO; } return Pfield.compareTo(Qfield); }
Example 4
Source File: XMLGregorianCalendarImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * <p>Implement Step B from * http://www.w3.org/TR/xmlschema-2/#dateTime-order.</p> */ private static int compareField(int Pfield, int Qfield) { if (Pfield == Qfield) { //fields are either equal in value or both undefined. // Step B. 1.1 AND optimized result of performing 1.1-1.4. return DatatypeConstants.EQUAL; } else { if (Pfield == DatatypeConstants.FIELD_UNDEFINED || Qfield == DatatypeConstants.FIELD_UNDEFINED) { // Step B. 1.2 return DatatypeConstants.INDETERMINATE; } else { // Step B. 1.3-4. return (Pfield < Qfield ? DatatypeConstants.LESSER : DatatypeConstants.GREATER); } } }
Example 5
Source File: DefaultSignavioDurationType.java From jdmn with Apache License 2.0 | 5 votes |
@Override public Boolean durationGreaterEqualThan(Duration first, Duration second) { if (first == null && second == null) { return null; } else if (first == null) { return null; } else if (second == null) { return null; } else { int compare = compare(first, second); return compare == DatatypeConstants.GREATER || compare == DatatypeConstants.EQUAL; } }
Example 6
Source File: XMLGregorianCalendarImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * <p>Indicates whether parameter <code>obj</code> is "equal to" this one.</p> * * @param obj to compare. * * @return <code>true</code> when <code>compare(this,(XMLGregorianCalendar)obj) == EQUAL.</code>. */ public boolean equals(Object obj) { if (obj == null || !(obj instanceof XMLGregorianCalendar)) { return false; } return compare((XMLGregorianCalendar) obj) == DatatypeConstants.EQUAL; }
Example 7
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static int compareField(BigInteger Pfield, BigInteger Qfield) { if (Pfield == null) { return (Qfield == null ? DatatypeConstants.EQUAL : DatatypeConstants.INDETERMINATE); } if (Qfield == null) { return DatatypeConstants.INDETERMINATE; } return Pfield.compareTo(Qfield); }
Example 8
Source File: XMLGregorianCalendarImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * <p>Indicates whether parameter <code>obj</code> is "equal to" this one.</p> * * @param obj to compare. * * @return <code>true</code> when <code>compare(this,(XMLGregorianCalendar)obj) == EQUAL.</code>. */ public boolean equals(Object obj) { if (obj == null || !(obj instanceof XMLGregorianCalendar)) { return false; } return compare((XMLGregorianCalendar) obj) == DatatypeConstants.EQUAL; }
Example 9
Source File: FEELXMLGregorianCalendar.java From jdmn with Apache License 2.0 | 5 votes |
private static int compareField(BigInteger field1, BigInteger field2) { if (field1 == null) { return field2 == null ? DatatypeConstants.EQUAL : DatatypeConstants.INDETERMINATE; } if (field2 == null) { return DatatypeConstants.INDETERMINATE; } return field1.compareTo(field2); }
Example 10
Source File: FEELXMLGregorianCalendar.java From jdmn with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof XMLGregorianCalendar)) { return false; } return compare((XMLGregorianCalendar) obj) == DatatypeConstants.EQUAL; }
Example 11
Source File: DoubleSignavioDurationType.java From jdmn with Apache License 2.0 | 5 votes |
@Override public Boolean durationGreaterEqualThan(Duration first, Duration second) { if (first == null && second == null) { return null; } else if (first == null) { return null; } else if (second == null) { return null; } else { int compare = compare(first, second); return compare == DatatypeConstants.GREATER || compare == DatatypeConstants.EQUAL; } }
Example 12
Source File: XMLGregorianCalendarImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static int compareField(BigInteger Pfield, BigInteger Qfield) { if (Pfield == null) { return (Qfield == null ? DatatypeConstants.EQUAL : DatatypeConstants.INDETERMINATE); } if (Qfield == null) { return DatatypeConstants.INDETERMINATE; } return Pfield.compareTo(Qfield); }
Example 13
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 14
Source File: XMLGregorianCalendarImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * * <p>Implements Step B from http://www.w3.org/TR/xmlschema-2/#dateTime-order </p> * @param P calendar instance with normalized timezone offset or * having same timezone as Q * @param Q calendar instance with normalized timezone offset or * having same timezone as P * * @return result of comparing P and Q, value of * {@link DatatypeConstants#EQUAL}, * {@link DatatypeConstants#LESSER}, * {@link DatatypeConstants#GREATER} or * {@link DatatypeConstants#INDETERMINATE}. */ private static int internalCompare(XMLGregorianCalendar P, XMLGregorianCalendar Q) { int result; // compare Year. if (P.getEon() == Q.getEon()) { // Eon field is only equal when null. // optimized case for comparing year not requiring eon field. result = compareField(P.getYear(), Q.getYear()); if (result != DatatypeConstants.EQUAL) { return result; } } else { result = compareField(P.getEonAndYear(), Q.getEonAndYear()); if (result != DatatypeConstants.EQUAL) { return result; } } result = compareField(P.getMonth(), Q.getMonth()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getDay(), Q.getDay()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getHour(), Q.getHour()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getMinute(), Q.getMinute()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getSecond(), Q.getSecond()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getFractionalSecond(), Q.getFractionalSecond()); return result; }
Example 15
Source File: XMLGregorianCalendarImpl.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * * <p>Implements Step B from http://www.w3.org/TR/xmlschema-2/#dateTime-order </p> * @param P calendar instance with normalized timezone offset or * having same timezone as Q * @param Q calendar instance with normalized timezone offset or * having same timezone as P * * @return result of comparing P and Q, value of * {@link DatatypeConstants#EQUAL}, * {@link DatatypeConstants#LESSER}, * {@link DatatypeConstants#GREATER} or * {@link DatatypeConstants#INDETERMINATE}. */ private static int internalCompare(XMLGregorianCalendar P, XMLGregorianCalendar Q) { int result; // compare Year. if (P.getEon() == Q.getEon()) { // Eon field is only equal when null. // optimized case for comparing year not requiring eon field. result = compareField(P.getYear(), Q.getYear()); if (result != DatatypeConstants.EQUAL) { return result; } } else { result = compareField(P.getEonAndYear(), Q.getEonAndYear()); if (result != DatatypeConstants.EQUAL) { return result; } } result = compareField(P.getMonth(), Q.getMonth()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getDay(), Q.getDay()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getHour(), Q.getHour()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getMinute(), Q.getMinute()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getSecond(), Q.getSecond()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getFractionalSecond(), Q.getFractionalSecond()); return result; }
Example 16
Source File: XMLGregorianCalendarImpl.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * * <p>Implements Step B from http://www.w3.org/TR/xmlschema-2/#dateTime-order </p> * @param P calendar instance with normalized timezone offset or * having same timezone as Q * @param Q calendar instance with normalized timezone offset or * having same timezone as P * * @return result of comparing P and Q, value of * {@link DatatypeConstants#EQUAL}, * {@link DatatypeConstants#LESSER}, * {@link DatatypeConstants#GREATER} or * {@link DatatypeConstants#INDETERMINATE}. */ private static int internalCompare(XMLGregorianCalendar P, XMLGregorianCalendar Q) { int result; // compare Year. if (P.getEon() == Q.getEon()) { // Eon field is only equal when null. // optimized case for comparing year not requiring eon field. result = compareField(P.getYear(), Q.getYear()); if (result != DatatypeConstants.EQUAL) { return result; } } else { result = compareField(P.getEonAndYear(), Q.getEonAndYear()); if (result != DatatypeConstants.EQUAL) { return result; } } result = compareField(P.getMonth(), Q.getMonth()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getDay(), Q.getDay()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getHour(), Q.getHour()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getMinute(), Q.getMinute()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getSecond(), Q.getSecond()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getFractionalSecond(), Q.getFractionalSecond()); return result; }
Example 17
Source File: XMLGregorianCalendarImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * * <p>Implements Step B from http://www.w3.org/TR/xmlschema-2/#dateTime-order </p> * @param P calendar instance with normalized timezone offset or * having same timezone as Q * @param Q calendar instance with normalized timezone offset or * having same timezone as P * * @return result of comparing P and Q, value of * {@link DatatypeConstants#EQUAL}, * {@link DatatypeConstants#LESSER}, * {@link DatatypeConstants#GREATER} or * {@link DatatypeConstants#INDETERMINATE}. */ private static int internalCompare(XMLGregorianCalendar P, XMLGregorianCalendar Q) { int result; // compare Year. if (P.getEon() == Q.getEon()) { // Eon field is only equal when null. // optimized case for comparing year not requiring eon field. result = compareField(P.getYear(), Q.getYear()); if (result != DatatypeConstants.EQUAL) { return result; } } else { result = compareField(P.getEonAndYear(), Q.getEonAndYear()); if (result != DatatypeConstants.EQUAL) { return result; } } result = compareField(P.getMonth(), Q.getMonth()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getDay(), Q.getDay()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getHour(), Q.getHour()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getMinute(), Q.getMinute()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getSecond(), Q.getSecond()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getFractionalSecond(), Q.getFractionalSecond()); return result; }
Example 18
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 19
Source File: XMLGregorianCalendarImpl.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * * <p>Implements Step B from http://www.w3.org/TR/xmlschema-2/#dateTime-order </p> * @param P calendar instance with normalized timezone offset or * having same timezone as Q * @param Q calendar instance with normalized timezone offset or * having same timezone as P * * @return result of comparing P and Q, value of * {@link DatatypeConstants#EQUAL}, * {@link DatatypeConstants#LESSER}, * {@link DatatypeConstants#GREATER} or * {@link DatatypeConstants#INDETERMINATE}. */ private static int internalCompare(XMLGregorianCalendar P, XMLGregorianCalendar Q) { int result; // compare Year. if (P.getEon() == Q.getEon()) { // Eon field is only equal when null. // optimized case for comparing year not requiring eon field. result = compareField(P.getYear(), Q.getYear()); if (result != DatatypeConstants.EQUAL) { return result; } } else { result = compareField(P.getEonAndYear(), Q.getEonAndYear()); if (result != DatatypeConstants.EQUAL) { return result; } } result = compareField(P.getMonth(), Q.getMonth()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getDay(), Q.getDay()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getHour(), Q.getHour()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getMinute(), Q.getMinute()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getSecond(), Q.getSecond()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getFractionalSecond(), Q.getFractionalSecond()); return result; }
Example 20
Source File: XMLGregorianCalendarImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * * <p>Implements Step B from http://www.w3.org/TR/xmlschema-2/#dateTime-order </p> * @param P calendar instance with normalized timezone offset or * having same timezone as Q * @param Q calendar instance with normalized timezone offset or * having same timezone as P * * @return result of comparing P and Q, value of * {@link DatatypeConstants#EQUAL}, * {@link DatatypeConstants#LESSER}, * {@link DatatypeConstants#GREATER} or * {@link DatatypeConstants#INDETERMINATE}. */ private static int internalCompare(XMLGregorianCalendar P, XMLGregorianCalendar Q) { int result; // compare Year. if (P.getEon() == Q.getEon()) { // Eon field is only equal when null. // optimized case for comparing year not requiring eon field. result = compareField(P.getYear(), Q.getYear()); if (result != DatatypeConstants.EQUAL) { return result; } } else { result = compareField(P.getEonAndYear(), Q.getEonAndYear()); if (result != DatatypeConstants.EQUAL) { return result; } } result = compareField(P.getMonth(), Q.getMonth()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getDay(), Q.getDay()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getHour(), Q.getHour()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getMinute(), Q.getMinute()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getSecond(), Q.getSecond()); if (result != DatatypeConstants.EQUAL) { return result; } result = compareField(P.getFractionalSecond(), Q.getFractionalSecond()); return result; }