List of usage examples for com.google.common.collect ComparisonChain start
public static ComparisonChain start()
From source file:com.opengamma.strata.pricer.rate.InflationRateSensitivity.java
@Override public int compareKey(PointSensitivity other) { if (other instanceof InflationRateSensitivity) { InflationRateSensitivity otherInflation = (InflationRateSensitivity) other; return ComparisonChain.start().compare(getIndex().toString(), otherInflation.getIndex().toString()) .compare(currency, otherInflation.currency) .compare(observation.getFixingMonth(), otherInflation.observation.getFixingMonth()).result(); }//from w ww .j a v a 2 s. c o m return getClass().getSimpleName().compareTo(other.getClass().getSimpleName()); }
From source file:org.agatom.springatom.cmp.action.model.AbstractAction.java
@Override public int compareTo(@Nonnull final Action o) { return ComparisonChain.start().compare(this.order, o.getOrder()).result(); }
From source file:org.apereo.portal.events.aggr.dao.jpa.AcademicTermDetailImpl.java
@Override public int compareTo(AcademicTermDetail o) { return ComparisonChain.start().compare(this.getStart(), o.getStart()).compare(this.getEnd(), o.getEnd()) .result();/*from www. j a v a 2 s . c om*/ }
From source file:com.tkmtwo.sarapi.ArsContext.java
@Override public int compareTo(ArsContext impl) { return ComparisonChain.start().compare(getHostName(), impl.getHostName()) .compare(getHostPort(), impl.getHostPort()).result(); }
From source file:com.opengamma.strata.pricer.fxopt.FxOptionSensitivity.java
@Override public int compareKey(PointSensitivity other) { if (other instanceof FxOptionSensitivity) { FxOptionSensitivity otherOption = (FxOptionSensitivity) other; return ComparisonChain.start().compare(volatilitiesName, otherOption.volatilitiesName) .compare(currencyPair.toString(), otherOption.currencyPair.toString()) .compare(expiry, otherOption.expiry).compare(strike, otherOption.strike) .compare(forward, otherOption.forward).compare(currency, otherOption.currency).result(); }// w ww . j a va2 s .co m return getClass().getSimpleName().compareTo(other.getClass().getSimpleName()); }
From source file:org.apache.guacamole.auth.mysql.MySQLVersion.java
/** * Returns whether this version is at least as recent as the given version. * * @param version/*from w ww . ja va 2 s .c o m*/ * The version to compare against. * * @return * true if the versions are associated with the same database server * type (MariaDB vs. MySQL) and this version is at least as recent as * the given version, false otherwise. */ public boolean isAtLeast(MySQLVersion version) { // If the databases use different version numbering schemes, the // version numbers are not comparable if (isMariaDB != version.isMariaDB) return false; // Compare major, minor, and patch number in order of precedence return ComparisonChain.start().compare(major, version.major).compare(minor, version.minor) .compare(patch, version.patch).result() >= 0; }
From source file:org.onebusaway.nyc.vehicle_tracking.impl.particlefilter.Particle.java
private static int oneParticleCompareTo(Particle t, Particle o) { if (t == o)/*from ww w . ja va 2s. co m*/ return 0; if (t == null) { if (o != null) return -1; } else if (o == null) { return 1; } final int particleComp = ComparisonChain.start() .compare(t.getTimestamp(), o.getTimestamp(), Ordering.natural().reverse()) .compare(t.getLogWeight(), o.getLogWeight(), Ordering.natural().reverse()) .compare(t.getData(), o.getData(), _particleDataOrdering.nullsLast()).result(); return particleComp; }
From source file:org.opencms.xml.content.CmsXmlContentValueLocation.java
/** * @see org.opencms.xml.content.I_CmsXmlContentLocation#getSubValues(java.lang.String) *///from w w w . j av a2s . c o m public List<I_CmsXmlContentValueLocation> getSubValues(String subPath) { List<I_CmsXmlContentValueLocation> result = new ArrayList<I_CmsXmlContentValueLocation>(); String requiredLastElement = CmsXmlUtils.getLastXpathElement(subPath); Locale locale = m_value.getLocale(); List<I_CmsXmlContentValue> subValues = Lists.newArrayList( m_value.getDocument().getValues(CmsXmlUtils.concatXpath(m_value.getPath(), subPath), locale)); Collections.sort(subValues, new Comparator<I_CmsXmlContentValue>() { public int compare(I_CmsXmlContentValue firstValue, I_CmsXmlContentValue secondValue) { String firstPath = CmsXmlUtils.removeXpathIndex(firstValue.getPath()); String secondPath = CmsXmlUtils.removeXpathIndex(secondValue.getPath()); int firstIndex = CmsXmlUtils.getXpathIndexInt(firstValue.getPath()); int secondIndex = CmsXmlUtils.getXpathIndexInt(secondValue.getPath()); int comparisonResult = ComparisonChain.start().compare(firstPath, secondPath) .compare(firstIndex, secondIndex).result(); return comparisonResult; } }); for (I_CmsXmlContentValue subValue : subValues) { if (subValue != null) { // if subPath is the path of one option of a choice element, getValues() will, strangely, // return all values of the choice, regardless of their name, so we need to check // the name by hand String lastElement = CmsXmlUtils.getLastXpathElement(subValue.getPath()); if (lastElement.equals(requiredLastElement)) { result.add(new CmsXmlContentValueLocation(subValue)); } } } return result; }
From source file:com.opengamma.strata.market.sensitivity.BondFutureOptionSensitivity.java
@Override public int compareKey(PointSensitivity other) { if (other instanceof BondFutureOptionSensitivity) { BondFutureOptionSensitivity otherOption = (BondFutureOptionSensitivity) other; return ComparisonChain.start() .compare(futureSecurityId.toString(), otherOption.futureSecurityId.toString()) .compare(expiry, otherOption.expiry).compare(futureExpiryDate, otherOption.futureExpiryDate) .compare(strikePrice, otherOption.strikePrice).compare(futurePrice, otherOption.futurePrice) .compare(currency, otherOption.currency).result(); }//from w w w . java2 s . c o m return getClass().getSimpleName().compareTo(other.getClass().getSimpleName()); }
From source file:org.spongepowered.common.data.manipulator.mutable.entity.SpongeHorseData.java
@Override public int compareTo(HorseData other) { return ComparisonChain.start().compare(this.horseColor.getId(), other.color().get().getId()) .compare(this.horseStyle.getId(), other.style().get().getId()) .compare(this.horseVariant.getId(), other.variant().get().getId()).result(); }