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:edu.utah.further.ds.further.model.impl.domain.PersonId.java
@Override public int compareTo(final PersonId other) { return new CompareToBuilder().append(other.getId(), this.getId()) .append(other.getDatasetId(), this.getDatasetId()).toComparison(); }
From source file:com.algoTrader.vo.ib.TickSnapshotEnd.java
/** * @param object to compare this object against * @return int if equal/*ww w. j av a2 s .co m*/ * @see Comparable#compareTo(Object) */ public int compareTo(final TickSnapshotEnd object) { if (object == null) { return -1; } // Check if the same object instance if (object == this) { return 0; } return new CompareToBuilder().append(this.getReqId(), object.getReqId()).toComparison(); }
From source file:com.algoTrader.vo.ib.NextValidId.java
/** * @param object to compare this object against * @return int if equal/* w ww .ja v a 2s . c om*/ * @see Comparable#compareTo(Object) */ public int compareTo(final NextValidId object) { if (object == null) { return -1; } // Check if the same object instance if (object == this) { return 0; } return new CompareToBuilder().append(this.getOrderId(), object.getOrderId()).toComparison(); }
From source file:com.algoTrader.vo.ib.ContractDetailsEnd.java
/** * @param object to compare this object against * @return int if equal//from w w w .jav a 2 s . c om * @see Comparable#compareTo(Object) */ public int compareTo(final ContractDetailsEnd object) { if (object == null) { return -1; } // Check if the same object instance if (object == this) { return 0; } return new CompareToBuilder().append(this.getReqId(), object.getReqId()).toComparison(); }
From source file:br.com.ingenieux.mojo.beanstalk.version.RollbackVersionMojo.java
@Override protected Object executeInternal() throws MojoExecutionException, MojoFailureException { // TODO: Deal with withVersionLabels DescribeApplicationVersionsRequest describeApplicationVersionsRequest = new DescribeApplicationVersionsRequest() .withApplicationName(applicationName); DescribeApplicationVersionsResult appVersions = getService() .describeApplicationVersions(describeApplicationVersionsRequest); DescribeEnvironmentsRequest describeEnvironmentsRequest = new DescribeEnvironmentsRequest() .withApplicationName(applicationName).withEnvironmentIds(curEnv.getEnvironmentId()) .withEnvironmentNames(curEnv.getEnvironmentName()).withIncludeDeleted(false); DescribeEnvironmentsResult environments = getService().describeEnvironments(describeEnvironmentsRequest); List<ApplicationVersionDescription> appVersionList = new ArrayList<ApplicationVersionDescription>( appVersions.getApplicationVersions()); List<EnvironmentDescription> environmentList = environments.getEnvironments(); if (environmentList.isEmpty()) { throw new MojoFailureException("No environments were found"); }/*from ww w .ja v a 2s .com*/ EnvironmentDescription d = environmentList.get(0); Collections.sort(appVersionList, new Comparator<ApplicationVersionDescription>() { @Override public int compare(ApplicationVersionDescription o1, ApplicationVersionDescription o2) { return new CompareToBuilder().append(o1.getDateUpdated(), o2.getDateUpdated()).toComparison(); } }); Collections.reverse(appVersionList); if (latestVersionInstead) { ApplicationVersionDescription latestVersionDescription = appVersionList.get(0); return changeToVersion(d, latestVersionDescription); } ListIterator<ApplicationVersionDescription> versionIterator = appVersionList.listIterator(); String curVersionLabel = d.getVersionLabel(); while (versionIterator.hasNext()) { ApplicationVersionDescription versionDescription = versionIterator.next(); String versionLabel = versionDescription.getVersionLabel(); if (curVersionLabel.equals(versionLabel) && versionIterator.hasNext()) { return changeToVersion(d, versionIterator.next()); } } throw new MojoFailureException("No previous version was found (current version: " + curVersionLabel); }
From source file:com.iggroup.oss.restdoclet.doclet.type.Uri.java
/** * {@inheritDoc}/*w w w. j a va 2s . co m*/ */ @Override public int compareTo(final Uri param) { int result; if (param == null) { result = 1; } else { result = new CompareToBuilder().append(uri, param.uri).append(type, param.type).toComparison(); } return result; }
From source file:com.twitter.hraven.JobId.java
/** * Compares two JobId objects on the basis of their * jobEpoch (jobtracker start time from the job ID) * and// w ww . j a v a2 s. c o m * jobSequence( jobtracker assigned sequence number for the job,) * * @param other * @return 0 if this jobEpoch and jobSequence are equal to * other jobEpoch and jobSequence, * 1 if this jobEpoch and jobSequence are greater than * other jobEpoch and jobSequence, * -1 if this jobEpoch and jobSequence less than * other jobEpoch and jobSequence * */ @Override public int compareTo(JobId o) { if (o == null) { // nulls sort last return -1; } return new CompareToBuilder().append(this.jobEpoch, o.getJobEpoch()) .append(this.jobSequence, o.getJobSequence()).toComparison(); }
From source file:com.algoTrader.vo.UnsubscribeTickVO.java
/** * @param object to compare this object against * @return int if equal//from ww w .j a v a 2 s . c om * @see Comparable#compareTo(Object) */ public int compareTo(final UnsubscribeTickVO object) { if (object == null) { return -1; } // Check if the same object instance if (object == this) { return 0; } return new CompareToBuilder().append(this.getSecurityId(), object.getSecurityId()).toComparison(); }
From source file:com.twitter.hraven.JobKey.java
/** * Compares two JobKey QualifiedJobId//from www . ja v a 2 s. c om * * @param other * @return 0 if the Qualified Job Ids are equal, * 1 if this QualifiedJobId greater than other QualifiedJobId, * -1 if this QualifiedJobId is less than other QualifiedJobId */ @Override public int compareTo(Object other) { if (other == null) { return -1; } JobKey otherKey = (JobKey) other; return new CompareToBuilder().appendSuper(super.compareTo(otherKey)).append(this.jobId, otherKey.getJobId()) .toComparison(); }
From source file:com.dp2345.entity.ProductImage.java
/** * compareTo/*from w w w . j a v a 2s . c om*/ * * @param productImage * ? * @return */ public int compareTo(ProductImage productImage) { return new CompareToBuilder().append(getOrder(), productImage.getOrder()).toComparison(); }