Example usage for org.apache.commons.lang.builder CompareToBuilder append

List of usage examples for org.apache.commons.lang.builder CompareToBuilder append

Introduction

In this page you can find the example usage for org.apache.commons.lang.builder CompareToBuilder append.

Prototype

public CompareToBuilder append(boolean[] lhs, boolean[] rhs) 

Source Link

Document

Appends to the builder the deep comparison of two boolean arrays.

  1. Check if arrays are the same using ==
  2. Check if for null, null is less than non-null
  3. Check array length, a shorter length array is less than a longer length array
  4. Check array contents element by element using #append(boolean,boolean)

Usage

From source file:org.oscarehr.PMmodule.model.IntakeAnswerElement.java

/**
 * @see Comparable#compareTo(Object)/*  w  w  w .jav a  2 s .  com*/
 */
public int compareTo(IntakeAnswerElement answerElement) {
    CompareToBuilder compareToBuilder = new CompareToBuilder();
    compareToBuilder.append(getId(), answerElement.getId());
    compareToBuilder.append(getElement(), answerElement.getElement());

    return compareToBuilder.toComparison();
}

From source file:org.tonguetied.usermanagement.UserRight.java

public int compareTo(final UserRight other) {
    CompareToBuilder builder = new CompareToBuilder();
    builder.append(permission, other.permission);
    return builder.toComparison();
}

From source file:org.xaloon.core.impl.plugin.tree.MenuItem.java

/**
 * Sorting current menu item by provided order property
 * <p>/*from  w  w  w.  ja  v a2s.  com*/
 * If order property id is not provided then order by name
 */
public int compareTo(MenuItem o) {
    if (o == null) {
        return 1;
    }
    CompareToBuilder compareToBuilder = new CompareToBuilder();
    compareToBuilder.append(getOrder(), o.getOrder());
    compareToBuilder.append(getKey(), o.getKey());

    return compareToBuilder.toComparison();
}

From source file:org.xaloon.wicket.plugin.image.model.JpaImageComposition.java

/**
 * Sorting current menu item by provided order property
 * <p>//from  w ww . ja  v a 2  s  .c o m
 * If order property id is not provided then order by name
 */
public int compareTo(JpaImageComposition o) {
    if (o == null) {
        return 1;
    }
    if (getObject() == null) {
        return 1;
    }
    CompareToBuilder compareToBuilder = new CompareToBuilder();
    compareToBuilder.append(getObject().getId(), o.getObject().getId());

    return compareToBuilder.toComparison();
}

From source file:uk.ac.ebi.embl.api.entry.qualifier.Qualifier.java

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;
    }/* w ww .  j av  a  2  s .c o  m*/
    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();
}

From source file:uk.ac.ebi.embl.api.entry.reference.Article.java

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();
}

From source file:uk.ac.ebi.embl.api.entry.reference.Book.java

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();
}

From source file:uk.ac.ebi.embl.api.entry.reference.ElectronicReference.java

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();
}

From source file:uk.ac.ebi.embl.api.entry.reference.Patent.java

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();
}

From source file:uk.ac.ebi.embl.api.entry.reference.Person.java

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();
}