本文整理汇总了Java中javax.xml.datatype.XMLGregorianCalendar.getEon方法的典型用法代码示例。如果您正苦于以下问题:Java XMLGregorianCalendar.getEon方法的具体用法?Java XMLGregorianCalendar.getEon怎么用?Java XMLGregorianCalendar.getEon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.datatype.XMLGregorianCalendar
的用法示例。
在下文中一共展示了XMLGregorianCalendar.getEon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: internalCompare
import javax.xml.datatype.XMLGregorianCalendar; //导入方法依赖的package包/类
/**
*
* <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;
}