本文整理汇总了Java中org.apache.commons.lang.builder.CompareToBuilder.toComparison方法的典型用法代码示例。如果您正苦于以下问题:Java CompareToBuilder.toComparison方法的具体用法?Java CompareToBuilder.toComparison怎么用?Java CompareToBuilder.toComparison使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.builder.CompareToBuilder
的用法示例。
在下文中一共展示了CompareToBuilder.toComparison方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compareTo
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
public int compareTo(Qualifier o) {
// The natural order of the qualifiers is the order in
// which they should appear in the flat file.
if (this.equals(o)) {
return 0;
}
final CompareToBuilder builder = new CompareToBuilder();
Integer thisOrder = ORDER_QUALS.get(this.name);
if (thisOrder == null) {
thisOrder = DEFAULT_ORDER_QUALS;
}
Integer otherOrder = ORDER_QUALS.get(o.name);
if (otherOrder == null) {
otherOrder = DEFAULT_ORDER_QUALS;
}
builder.append(thisOrder, otherOrder);
return builder.toComparison();
}
示例2: compareTo
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
/**
* Comparison method for natural ordering. Compares based on the logical
* triple (the s/p/o/context information in the underlying RyaStatement)
* and then by the metadata contained in the RyaStatement if the triples are
* the same.
* @return Zero if both RyaStatementWritables contain equivalent statements
* or both have null statements; otherwise, an integer whose sign
* corresponds to a consistent ordering.
*/
@Override
public int compareTo(RyaStatementWritable other) {
CompareToBuilder builder = new CompareToBuilder();
RyaStatement rsThis = this.getRyaStatement();
RyaStatement rsOther = other.getRyaStatement(); // should throw NPE if other is null, as per Comparable contract
builder.append(rsThis == null, rsOther == null);
if (rsThis != null && rsOther != null) {
builder.append(rsThis.getSubject(), rsOther.getSubject());
builder.append(rsThis.getPredicate(), rsOther.getPredicate());
builder.append(rsThis.getObject(), rsOther.getObject());
builder.append(rsThis.getContext(), rsOther.getContext());
builder.append(rsThis.getQualifer(), rsOther.getQualifer());
builder.append(rsThis.getColumnVisibility(), rsOther.getColumnVisibility());
builder.append(rsThis.getValue(), rsOther.getValue());
builder.append(rsThis.getTimestamp(), rsOther.getTimestamp());
}
return builder.toComparison();
}
示例3: compareTo
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
/**
* @see Comparable#compareTo(Object)
*/
public int compareTo(IntakeAnswerElement answerElement) {
CompareToBuilder compareToBuilder = new CompareToBuilder();
compareToBuilder.append(getId(), answerElement.getId());
compareToBuilder.append(getElement(), answerElement.getElement());
return compareToBuilder.toComparison();
}
示例4: compareTo
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
/**
* @see Comparable#compareTo(Object)
*/
public int compareTo(IntakeAnswer answer) {
CompareToBuilder compareToBuilder = new CompareToBuilder();
compareToBuilder.append(getId(), answer.getId());
compareToBuilder.append(getNode().getId(), answer.getNode().getId());
compareToBuilder.append(getIndex(),answer.getIndex());
return compareToBuilder.toComparison();
}
示例5: compareTo
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
public int compareTo(XRef o) {
final CompareToBuilder builder = new CompareToBuilder();
builder.append(this.database, o.database);
builder.append(this.primaryAccession, o.primaryAccession);
builder.append(this.secondaryAccession, o.secondaryAccession);
return builder.toComparison();
}
示例6: compareTo
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
public int compareTo(Person o) {
final Person other = o;
final CompareToBuilder builder = new CompareToBuilder();
builder.append(this.surname, other.surname);
builder.append(this.firstName, other.firstName);
return builder.toComparison();
}
示例7: compareTo
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
public int compareTo(Patent o) {
final Patent other = o;
final CompareToBuilder builder = new CompareToBuilder();
builder.appendSuper(super.compareTo(other));
builder.append(this.patentOffice, other.patentOffice);
builder.append(this.patentNumber, other.patentNumber);
builder.append(this.patentType, other.patentType);
builder.append(this.sequenceNumber, other.sequenceNumber);
builder.append(this.day, other.day);
String[] thisApplicants = this.applicants.toArray(new String[this.applicants.size()]);
String[] otherApplicants = other.applicants.toArray(new String[this.applicants.size()]);
builder.append(thisApplicants, otherApplicants);
return builder.toComparison();
}
示例8: compareTo
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
public int compareTo(Reference o) {
final Reference other = o;
final CompareToBuilder builder = new CompareToBuilder();
builder.append(this.referenceNumber, other.referenceNumber);
builder.append(this.publication, other.publication);
builder.append(this.comment, other.comment);
// TODO builder.append(this.locations, other.locations);
return builder.toComparison();
}
示例9: compareTo
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
public int compareTo(Thesis o) {
final Thesis other = o;
final CompareToBuilder builder = new CompareToBuilder();
builder.appendSuper(super.compareTo(other));
builder.append(this.institute, other.institute);
builder.append(this.year, other.year);
return builder.toComparison();
}
示例10: compareTo
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
public int compareTo(Publication obj) {
Publication other = obj;
final CompareToBuilder builder = new CompareToBuilder();
builder.append(this.title, other.title);
builder.append(this.consortium, other.consortium);
Person[] thisAuthors = this.authors.toArray(new Person[this.authors.size()]);
Person[] otherAuthors = other.authors.toArray(new Person[other.authors.size()]);
builder.append(thisAuthors, otherAuthors);
XRef[] thisXRefs = this.xRefs.toArray(new XRef[this.xRefs.size()]);
XRef[] otherXRefs = other.xRefs.toArray(new XRef[other.xRefs.size()]);
builder.append(thisXRefs, otherXRefs);
return builder.toComparison();
}
示例11: compareTo
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
public int compareTo(Article o) {
final Article other = (Article) o;
final CompareToBuilder builder = new CompareToBuilder();
builder.appendSuper(super.compareTo(other));
builder.append(this.firstPage, other.firstPage);
builder.append(this.lastPage, other.lastPage);
builder.append(this.volume, other.volume);
builder.append(this.issue, other.issue);
builder.append(this.journal, other.journal);
builder.append(this.year, other.year);
return builder.toComparison();
}
示例12: compareTo
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
public int compareTo(Book o) {
final Book other = (Book) o;
final CompareToBuilder builder = new CompareToBuilder();
builder.appendSuper(super.compareTo(other));
builder.append(this.bookTitle, other.bookTitle);
builder.append(this.firstPage, other.firstPage);
builder.append(this.lastPage, other.lastPage);
builder.append(this.publisher, other.publisher);
builder.append(this.year, other.year);
Person[] thisEditors = this.editors.toArray(new Person[this.editors.size()]);
Person[] otherEditors = other.editors.toArray(new Person[other.editors.size()]);
builder.append(thisEditors, otherEditors);
return builder.toComparison();
}
示例13: compareTo
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
public int compareTo(Submission o) {
final Submission other = o;
final CompareToBuilder builder = new CompareToBuilder();
builder.appendSuper(super.compareTo(other));
builder.append(this.day, other.day);
builder.append(this.submitterAddress, other.submitterAddress);
return builder.toComparison();
}
示例14: compareTo
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
public int compareTo(ElectronicReference o) {
final ElectronicReference other = (ElectronicReference) o;
final CompareToBuilder builder = new CompareToBuilder();
builder.appendSuper(super.compareTo(other));
builder.append(this.text, other.text);
return builder.toComparison();
}
示例15: compareBigMap
import org.apache.commons.lang.builder.CompareToBuilder; //导入方法依赖的package包/类
private int compareBigMap(Map<?, ?> o1, Map<?, ?> o2)
{
if (o1 == null || o1.values() == null)
return -1;
if (o2 == null || o2.values() == null)
return 1;
CompareToBuilder cb = new CompareToBuilder();
cb.append(o1.toString(), o2.toString());
return cb.toComparison();
}