List of usage examples for org.apache.commons.lang.builder CompareToBuilder CompareToBuilder
public CompareToBuilder()
Constructor for CompareToBuilder.
Starts off assuming that the objects are equal.
From source file:org.jasig.portlet.newsreader.NewsDefinition.java
@Override public int compareTo(NewsDefinition def) { return new CompareToBuilder().append(this.name, def.getName()).append(this.id, def.getId()).toComparison(); }
From source file:org.jasig.schedassist.impl.statistics.AppointmentEvent.java
/** * Uses only eventTimestamp and eventId fields, in that order * of precedence.//from w w w . j av a 2 s .c o m * * (non-Javadoc) * @see java.lang.Comparable#compareTo(java.lang.Object) */ @Override public int compareTo(AppointmentEvent o) { return new CompareToBuilder().append(this.eventTimestamp, o.eventTimestamp).append(this.eventId, o.eventId) .toComparison(); }
From source file:org.jasig.schedassist.impl.statistics.DailyEventSummary.java
/** * //from w w w . j a v a2s.c o m * @param rhs * @return */ @Override public int compareTo(DailyEventSummary rhs) { return new CompareToBuilder().append(this.date, rhs.date).toComparison(); }
From source file:org.jasig.schedassist.model.AvailableBlock.java
/** * Order of comparison:/* w w w. j av a 2s .c o m*/ * <ol> * <li>startTime</li> * <li>endTime</li> * </ol> * * The visitorLimit and meetingLocation fields are immaterial to comparison. * * @see java.lang.Comparable#compareTo(Object) */ public int compareTo(AvailableBlock o) { return new CompareToBuilder().append(this.startTime, o.startTime).append(this.endTime, o.endTime) .toComparison(); }
From source file:org.jasig.schedassist.model.PublicProfileId.java
@Override public int compareTo(PublicProfileId o) { return new CompareToBuilder().append(this.ownerDisplayName, o.ownerDisplayName).toComparison(); }
From source file:org.jenkins.ci.backend.plugin_report_card.Plugin.java
public int compareTo(final Plugin other) { if (this == other) { return 0; }//from w w w.j a va 2s. co m int rc; rc = new CompareToBuilder().append(parentVersion, other.getParentVersion()).toComparison(); if (rc != 0) { return rc; } rc = new CompareToBuilder().append(parentGroupId, other.getParentGroupId()).toComparison(); if (rc != 0) { return rc; } rc = new CompareToBuilder().append(parentArtifactId, other.getParentArtifactId()).toComparison(); if (rc != 0) { return rc; } rc = new CompareToBuilder().append(groupId, other.getGroupId()).toComparison(); if (rc != 0) { return rc; } rc = new CompareToBuilder().append(artifactId, other.getArtifactId()).toComparison(); if (rc != 0) { return rc; } rc = new CompareToBuilder().append(version, other.getVersion()).toComparison(); if (rc != 0) { return rc; } return new CompareToBuilder().append(repositoryUrl, other.getRepositoryUrl()).toComparison(); }
From source file:org.jgap.Configuration.java
/** * The compareTo-method./*from w w w . jav a 2s. c o m*/ * * @param a_other the other object to compare * @return -1, 0, 1 * * @author Klaus Meffert * @since 3.2 */ public int compareTo(Object a_other) { if (a_other == null) { return 1; } else { Configuration other = (Configuration) a_other; try { return new CompareToBuilder().append(m_config.m_populationSize, other.m_config.m_populationSize) .append(m_factory, other.m_factory).append(m_breeder, other.m_breeder) .append(m_objectiveFunction, other.m_objectiveFunction) .append(m_fitnessEvaluator, other.m_fitnessEvaluator) .append(m_bulkObjectiveFunction, other.m_bulkObjectiveFunction) .append(m_sampleChromosome, other.m_sampleChromosome) .append(m_randomGenerator, other.m_randomGenerator) // .append(m_eventManager, other.m_eventManager) // .append(m_chromosomePool, other.m_chromosomePool) .append(m_geneticOperators.toArray(), other.m_geneticOperators.toArray()) .append(m_chromosomeSize, other.m_chromosomeSize) .append(m_preSelectors, other.m_preSelectors).append(m_postSelectors, other.m_postSelectors) // .append(m_popConstantSelector, other.m_popConstantSelector) .append(m_preserveFittestIndividual, other.m_preserveFittestIndividual) // .append(m_conHandler, other.m_conHandler) .append(threadKey, other.threadKey) .append(m_keepPopulationSizeConstant, other.m_keepPopulationSizeConstant) .append(m_alwaysCalculateFitness, other.m_alwaysCalculateFitness) .append(m_minPercentageSizePopulation, other.m_minPercentageSizePopulation) .append(m_selectFromPrevGen, other.m_selectFromPrevGen) .append(m_generationNr, other.m_generationNr).append(m_name, other.m_name) // .append(m_propertyBag, other.m_propertyBag) .append(m_settingsLocked, other.m_settingsLocked).toComparison(); } catch (ClassCastException cex) { throw new RuntimeException( "Cannot compare all objects within" + " org.jgap.Configuration, because at" + " least one does not implement interface" + " java.lang.Comparable!"); } } }
From source file:org.jgap.distr.Culture.java
/** * The compareTo-method.//from www . j a v a 2 s . com * * @param a_other the other object to compare * @return -1, 0, 1 * * @author Klaus Meffert * @since 3.0 */ public int compareTo(Object a_other) { Culture other = (Culture) a_other; if (other == null) { return 1; } // Problem: Vector does not implement Comparable. Thus we call toArray(). // ---------------------------------------------------------------------- return new CompareToBuilder().append(m_size, other.m_size).append(m_memory, other.m_memory) .append(m_memoryNames.toArray(), other.m_memoryNames.toArray()).toComparison(); }
From source file:org.jgap.distr.CultureMemoryCell.java
/** * The compareTo-method.// w w w . jav a2 s .com * @param a_other the other object to compare * @return -1, 0, 1 * * @author Klaus Meffert * @since 3.0 */ public int compareTo(Object a_other) { CultureMemoryCell other = (CultureMemoryCell) a_other; if (other == null) { return 1; } return new CompareToBuilder().append(m_value, other.m_value).append(m_version, other.m_version) .append(m_historySize, other.m_historySize).toComparison(); }
From source file:org.jgap.gp.CommandGene.java
/** * The compareTo-method. Considers application data when the configuration * asks for this./* ww w .j a v a 2s.c o m*/ * * @param a_other the other object to compare * @return -1, 0, 1 * * @author Klaus Meffert * @since 3.0 */ public int compareTo(Object a_other) { if (a_other == null) { return 1; } CommandGene other = (CommandGene) a_other; if (getClass() != other.getClass()) { /**@todo do it more precisely*/ return -1; } else { CompareToBuilder comparator = new CompareToBuilder(); comparator.append(size(), other.size()).append(m_subChildTypes, other.m_subChildTypes) .append(m_subReturnType, other.m_subReturnType); if (m_compareAppData) { comparator.append(m_applicationData, other.m_applicationData); } return comparator.toComparison(); } }