本文整理了Java中javax.xml.datatype.XMLGregorianCalendar.compare()
方法的一些代码示例,展示了XMLGregorianCalendar.compare()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLGregorianCalendar.compare()
方法的具体详情如下:
包路径:javax.xml.datatype.XMLGregorianCalendar
类名称:XMLGregorianCalendar
方法名:compare
[英]Compare two instances of W3C XML Schema 1.0 date/time datatypes according to partial order relation defined in W3C XML Schema 1.0 Part 2, Section 3.2.7.3, Order relation on dateTime.
xsd:dateTime
datatype field mapping to accessors of this class are defined in date/time field mapping table.
[中]根据W3C XML Schema 1.0 Part 2, Section 3.2.7.3, Order relation on dateTime中定义的偏序关系,比较W3C XML Schema 1.0日期/时间数据类型的两个实例。xsd:dateTime
映射到此类的访问器的数据类型字段在date/time field mapping table中定义。
代码示例来源:origin: robovm/robovm
/**
* <p>Indicates whether parameter <code>obj</code> is "equal to" this one.</p>
*
* @param obj to compare.
*
* @return <code>true</code> when <code>obj</code> is an instance of <code>XMLGregorianCalendar</code>
* and {@link #compare(XMLGregorianCalendar obj)} returns {@link DatatypeConstants#EQUAL}, otherwise <code>false</code>.
*/
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof XMLGregorianCalendar) {
return compare((XMLGregorianCalendar) obj) == DatatypeConstants.EQUAL;
}
return false;
}
代码示例来源:origin: Evolveum/midpoint
public static boolean isFresher(XMLGregorianCalendar theTimestamp, XMLGregorianCalendar refTimestamp) {
if (theTimestamp == null) {
return false;
}
if (refTimestamp == null) {
return true;
}
return theTimestamp.compare(refTimestamp) == DatatypeConstants.GREATER;
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore
@Override
public int compare(XMLGregorianCalendar xmlGregorianCalendar)
{
return
this.xmlGregorianCalendar.compare
(xmlGregorianCalendar instanceof XMLCalendar ? ((XMLCalendar)xmlGregorianCalendar).xmlGregorianCalendar : xmlGregorianCalendar);
}
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore
@Override
public int compare(XMLGregorianCalendar xmlGregorianCalendar)
{
return
this.xmlGregorianCalendar.compare
(xmlGregorianCalendar instanceof XMLCalendar ? ((XMLCalendar)xmlGregorianCalendar).xmlGregorianCalendar : xmlGregorianCalendar);
}
代码示例来源:origin: Evolveum/midpoint
public static int compare(XMLGregorianCalendar o1, XMLGregorianCalendar o2) {
if (o1 == null && o2 == null) {
return 0;
}
if (o1 == null) {
return -1;
}
if (o2 == null) {
return 1;
}
return o1.compare(o2);
}
代码示例来源:origin: Evolveum/midpoint
public static void assertBetween(String message, XMLGregorianCalendar start, XMLGregorianCalendar end,
XMLGregorianCalendar actual) {
assertNotNull(message + " is null", actual);
if (start != null) {
assertTrue(message+": expected time to be after "+start+" but it was "+actual,
actual.compare(start) == DatatypeConstants.GREATER || actual.compare(start) == DatatypeConstants.EQUAL);
}
if (end != null) {
assertTrue(message+": expected time to be before "+end+" but it was "+actual,
actual.compare(end) == DatatypeConstants.LESSER || actual.compare(end) == DatatypeConstants.EQUAL);
}
}
代码示例来源:origin: apache/jena
/** Compare date times, including "indeterminate" rather than applying locale timezone */
private static int compareXSDDateTime(XMLGregorianCalendar dt1, XMLGregorianCalendar dt2) {
// Returns codes are -1/0/1 but also 2 for "Indeterminate"
// which occurs when one has a timezone and one does not
// and they are less then 14 hours apart.
// F&O has an "implicit timezone" - this code implements the XMLSchema
// compare algorithm.
int x = dt1.compare(dt2) ;
return convertComparison(x) ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
private static int compareXSDDateTime(XMLGregorianCalendar dt1 , XMLGregorianCalendar dt2)
{
// Returns codes are -1/0/1 but also 2 for "Indeterminate"
// which occurs when one has a timezone and one does not
// and they are less then 14 hours apart.
// F&O has an "implicit timezone" - this code implements the XMLSchema compare algorithm.
int x = dt1.compare(dt2) ;
return convertComparison(x) ;
}
代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core
private int compare(XMLGregorianCalendar first, XMLGregorianCalendar second) {
XMLGregorianCalendar normal1 = normalize(first);
XMLGregorianCalendar normal2 = normalize(second);
return normal1.compare(normal2);
}
代码示例来源:origin: ORCID/ORCID-Source
public static LastModifiedDate returnLatestLastModifiedDate(LastModifiedDate latest, LastModifiedDate temp) {
if (temp == null) {
return latest;
}
if (latest == null) {
return temp;
}
if (latest.getValue().compare(temp.getValue()) == -1) {
return temp;
}
return latest;
}
代码示例来源:origin: ORCID/ORCID-Source
public boolean after(LastModifiedDate other) {
if(this.value == null) {
return false;
}
if(other == null || other.getValue() == null) {
return true;
}
return other.getValue().compare(this.value) < 0;
}
}
代码示例来源:origin: ORCID/ORCID-Source
public boolean after(LastModifiedDate other) {
if(this.value == null) {
return false;
}
if(other == null || other.getValue() == null) {
return true;
}
return other.getValue().compare(this.value) < 0;
}
}
代码示例来源:origin: ORCID/ORCID-Source
public boolean after(LastModifiedDate other) {
if(this.value == null) {
return false;
}
if(other == null || other.getValue() == null) {
return true;
}
return other.getValue().compare(this.value) < 0;
}
}
代码示例来源:origin: ORCID/ORCID-Source
public boolean after(LastModifiedDate other) {
if(this.value == null) {
return false;
}
if(other == null || other.getValue() == null) {
return true;
}
return other.getValue().compare(this.value) < 0;
}
}
代码示例来源:origin: com.bitplan/mediawiki-japi
@Override
public int compare(Rc lRc, Rc rRc) {
int result = rRc.getTimestamp().compare(lRc.getTimestamp());
return result;
}
});
代码示例来源:origin: goldmansachs/jdmn
private int compare(XMLGregorianCalendar first, XMLGregorianCalendar second) {
XMLGregorianCalendar normal1 = normalize(first);
XMLGregorianCalendar normal2 = normalize(second);
return normal1.compare(normal2);
}
代码示例来源:origin: org.openfuxml/ofx-chart
public int compare(Data a, Data b)
{
return a.getRecord().compare(b.getRecord());
}
}
代码示例来源:origin: ORCID/ORCID-Source
public boolean after(LastModifiedDate other) {
if(this.value == null) {
return false;
}
if(other == null || other.getValue() == null) {
return true;
}
return other.getValue().compare(this.value) < 0;
}
}
代码示例来源:origin: com.bitplan/mediawiki-japi
@Override
public int compare(Rc lRc, Rc rRc) {
int result = lRc.getTitle().compareTo(rRc.getTitle());
if (result == 0) {
result = rRc.getTimestamp().compare(lRc.getTimestamp());
}
return result;
}
});
代码示例来源:origin: Evolveum/midpoint
public static void addTo(EnvironmentalPerformanceInformationType rv, EnvironmentalPerformanceInformationType delta) {
addProvisioningTo(rv, delta.getProvisioningStatistics());
addMappingsTo(rv, delta.getMappingsStatistics());
addNotificationsTo(rv, delta.getNotificationsStatistics());
if (delta.getLastMessageTimestamp() != null) {
if (rv.getLastMessageTimestamp() == null || rv.getLastMessageTimestamp().compare(delta.getLastMessageTimestamp()) == DatatypeConstants.LESSER) {
rv.setLastMessageTimestamp(delta.getLastMessageTimestamp());
rv.setLastMessage(delta.getLastMessage());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!