@Override
 public int compareTo(Credentials o) {
   ComparisonChain chain =
       ComparisonChain.start().compare(name, o.getName()).compare(user, o.getUser());
   if (o instanceof AmazonGeneratedKeyPairCredentials) {
     chain.compare(
         privateKeyDigest.get(),
         o.as(AmazonGeneratedKeyPairCredentials.class).privateKeyDigest.get());
   }
   return chain.result();
 }
 @Override
 public int compareTo(Car car) {
   Preconditions.checkNotNull(car);
   Preconditions.checkState(timeElapsed != 0L, "Car didn't join the race.");
   Preconditions.checkState(car.getTimeElapsed() != 0L, "Car didn't join the race.");
   return ComparisonChain.start().compare(timeElapsed, car.getTimeElapsed()).result();
 }
 @Override
 public int compare(EconomicDataSnapshot o1, EconomicDataSnapshot o2) {
   return ComparisonChain.start()
       .compare(o1.year, o2.year)
       .compare(o1.fraction, o2.fraction)
       .result();
 }
示例#4
0
 @Override
 public int compareTo(PluginInfo that) {
   return ComparisonChain.start()
       .compare(this.name, that.name)
       .compare(this.version, that.version, Ordering.natural().nullsFirst())
       .result();
 }
示例#5
0
 public int compareToGuava(Person that) {
   return ComparisonChain.start()
       .compare(this.lastName, that.lastName)
       .compare(this.firstName, that.firstName)
       .compare(this.zipCode, that.zipCode, Ordering.natural().nullsLast())
       .result();
 }
示例#6
0
 @Override
 public int compareTo(VariableEntity that) {
   return ComparisonChain.start() //
       .compare(entityType, that.getType()) //
       .compare(entityIdentifier, that.getIdentifier()) //
       .result();
 }
示例#7
0
 @Override
 public int compare(Event e1, Event e2) {
   return ComparisonChain.start()
       .compare(e1.getItemId(), e2.getItemId())
       .compare(e1.getTimestamp(), e2.getTimestamp())
       .result();
 }
 @AfterTemplate
 <T> int after(T left, T right) {
   return ComparisonChain.start()
       .compare(propertyA(left), propertyA(right))
       .compare(propertyB(left), propertyB(right))
       .result();
 }
示例#9
0
 @Override
 public int compareTo(ChangedRow that) {
   return ComparisonChain.start()
       .compare(this.row, that.row, rowComparator(precision))
       .compareFalseFirst(this.changed == Changed.ADDED, that.changed == Changed.ADDED)
       .result();
 }
示例#10
0
 @Override
 public int compare(Statement s1, Statement s2) {
   return ComparisonChain.start()
       .compare(s1.getPredicate().asNode(), s2.getPredicate().asNode(), nodeComparator)
       .compare(s1.getObject().asNode(), s2.getObject().asNode(), nodeComparator)
       .result();
 }
示例#11
0
 @Override
 public int compareTo(@NotNull Subject other) {
   return ComparisonChain.start() //
       .compare(type, other.type) //
       .compare(principal, other.principal) //
       .result();
 }
示例#12
0
 @Override
 public int compareTo(PackageIdentifier that) {
   return ComparisonChain.start()
       .compare(repository.toString(), that.repository.toString())
       .compare(pkgName, that.pkgName)
       .result();
 }
示例#13
0
 @Override
 public int compare(PointInt o1, PointInt o2) {
   return ComparisonChain.start()
       .compare(o1.getX(), o2.getX())
       .compare(o1.getY(), o2.getY())
       .result();
 }
示例#14
0
  @Override
  public int compareTo(Employee o) {
    int diff =
        ComparisonChain.start()
            .compare(lastName, o.lastName, Ordering.from(String.CASE_INSENSITIVE_ORDER))
            .compare(firstName, o.firstName, Ordering.from(String.CASE_INSENSITIVE_ORDER))
            .compare(title, o.title, Ordering.from(String.CASE_INSENSITIVE_ORDER).nullsFirst())
            .compare(
                titleCourtesy,
                o.titleCourtesy,
                Ordering.from(String.CASE_INSENSITIVE_ORDER).nullsFirst())
            .compare(birthDate, o.birthDate, Ordering.natural().nullsFirst())
            .compare(hireDate, o.hireDate, Ordering.natural().nullsFirst())
            .compare(address, o.address, Ordering.from(String.CASE_INSENSITIVE_ORDER).nullsFirst())
            .compare(city, o.city, Ordering.from(String.CASE_INSENSITIVE_ORDER).nullsFirst())
            .compare(region, o.region, Ordering.from(String.CASE_INSENSITIVE_ORDER).nullsFirst())
            .compare(
                postalCode, o.postalCode, Ordering.from(String.CASE_INSENSITIVE_ORDER).nullsFirst())
            .compare(country, o.country, Ordering.from(String.CASE_INSENSITIVE_ORDER).nullsFirst())
            .compare(
                homePhone, o.homePhone, Ordering.from(String.CASE_INSENSITIVE_ORDER).nullsFirst())
            .compare(
                extension, o.extension, Ordering.from(String.CASE_INSENSITIVE_ORDER).nullsFirst())
            .compare(reportsTo, o.reportsTo, Ordering.natural().nullsFirst())
            .result();
    if (diff != 0) return diff;

    if (photo == null) return o.photo == null ? 0 : -1;
    if (o.photo == null) return 1;
    return UnsignedBytes.lexicographicalComparator().compare(photo, o.photo);
  }
示例#15
0
 @Override
 public int compareTo(ObjectDemo that) {
   return ComparisonChain.start()
       .compare(this.propertiesOne, that.propertiesOne)
       .compare(this.propertiesTwo, that.propertiesTwo, Ordering.<String>natural().nullsLast())
       .result();
 }
 @Override
 public int compareTo(ExperienceHolderData o) {
   return ComparisonChain.start()
       .compare(o.level().get().intValue(), this.level)
       .compare(o.totalExperience().get().intValue(), this.totalExp)
       .compare(o.experienceSinceLevel().get().intValue(), this.expSinceLevel)
       .result();
 }
示例#17
0
 @Override
 public int compare(RegisteredType o1, RegisteredType o2) {
   return ComparisonChain.start()
       .compareTrueFirst(o1.isDisabled(), o2.isDisabled())
       .compareTrueFirst(o1.isDeprecated(), o2.isDeprecated())
       .compare(o1.getSymbolicName(), o2.getSymbolicName(), NaturalOrderComparator.INSTANCE)
       .compare(o1.getVersion(), o2.getVersion(), VersionComparator.INSTANCE)
       .result();
 }
 @Override
 public int compareTo(Key other) {
   if (other != null && other instanceof YearMonthKey) {
     YearMonthKey o = (YearMonthKey) other;
     return ComparisonChain.start().compare(year, o.year).compare(month, o.month).result();
   } else {
     return -1;
   }
 }
示例#19
0
 @Override
 public int compareTo(MilePostLink o) {
   return ComparisonChain.start()
       .compare(uuid, o.uuid)
       .compare(border, o.border)
       .compare(inlet, o.inlet)
       .compare(river, o.river)
       .result();
 }
示例#20
0
 @Override
 public int compareTo(@Nullable SimulationTask o) {
   assert o != null;
   return ComparisonChain.start()
       .compare(scenarioId, o.scenarioId)
       .compare(configurationId, o.configurationId)
       .compare(objectiveFunctionId, o.objectiveFunctionId)
       .compare(postProcessorId, o.postProcessorId, Ordering.natural().nullsLast())
       .compare(seed, o.seed)
       .result();
 }
 @Override
 public int compareTo(MobSpawnerData o) {
   return ComparisonChain.start()
       .compare(o.remainingDelay().get().intValue(), this.remainingDelay)
       .compare(o.minimumSpawnDelay().get().intValue(), this.minimumDelay)
       .compare(o.maximumSpawnDelay().get().intValue(), this.maximumDelay)
       .compare(o.maximumNearbyEntities().get().intValue(), this.maximumEntities)
       .compare(o.spawnCount().get().intValue(), this.count)
       .compare(o.requiredPlayerRange().get().intValue(), this.playerRange)
       .compare(o.spawnRange().get().intValue(), this.spawnRange)
       .result();
 }
示例#22
0
    @Override
    public int compareTo(NamedQueue other) {
      Preconditions.checkState(
          Thread.holdsLock(SharedBuffer.this),
          "Thread must hold a lock on the %s",
          SharedBuffer.class.getSimpleName());

      return ComparisonChain.start()
          .compare(this.sequenceId, other.sequenceId)
          .compare(this.queueId, other.queueId)
          .result();
    }
 @Override
 public int compareKey(PointSensitivity other) {
   if (other instanceof FxForwardSensitivity) {
     FxForwardSensitivity otherFx = (FxForwardSensitivity) other;
     return ComparisonChain.start()
         .compare(currencyPair.toString(), otherFx.currencyPair.toString())
         .compare(currency, otherFx.currency)
         .compare(referenceCurrency, otherFx.referenceCurrency)
         .compare(referenceDate, otherFx.referenceDate)
         .result();
   }
   return getClass().getSimpleName().compareTo(other.getClass().getSimpleName());
 }
示例#24
0
 // Again, overriding for generics
 @Override
 public int compareTo(M o) {
   final Map<K, V> thisMap = getValue();
   final Map<K, V> otherMap = o.asMap();
   final Set<K> thisKeySet = thisMap.keySet();
   final Set<K> otherKeySet = otherMap.keySet();
   final Collection<V> thisValueSet = thisMap.values();
   final Collection<V> otherValueSet = otherMap.values();
   return ComparisonChain.start()
       .compare(thisKeySet.containsAll(otherKeySet), otherKeySet.containsAll(thisKeySet))
       .compare(thisValueSet.containsAll(otherValueSet), otherValueSet.containsAll(thisValueSet))
       .result();
 }
示例#25
0
 @Override
 public int compareTo(Dataset that) {
   return ComparisonChain.start()
       .compare(this.urn, that.urn)
       .compare(this.name, that.name)
       .compare(this.os, that.os)
       .compare(this.type, that.type)
       .compare(this.description, that.description)
       .compare(this.version, that.version)
       .compare(this.created, that.created)
       .compare(this.id, that.id)
       .result();
 }
示例#26
0
 @Override
 public int compareTo(HiveRoleGrant other) {
   if (other == null) {
     return 1;
   }
   return ComparisonChain.start()
       .compare(roleName, other.roleName)
       .compare(principalName, other.principalName)
       .compare(principalType, other.principalType)
       .compare(grantOption, other.grantOption)
       .compare(grantTime, other.grantTime)
       .compare(grantor, other.grantor)
       .result();
 }
示例#27
0
    /**
     * Compares this revision with the specified object for order. Returns a negative integer, zero,
     * or a positive integer as this object is less than, equal to, or greater than the specified
     * object.
     *
     * <p>
     *
     * @param rev revision to be compared for order with this revision.
     * @return a negative integer, zero, or a positive integer as this object is less than, equal
     *     to, or greater than the specified object.
     */
    @Override
    public int compareTo(Revision rev) {
      checkNotNull(rev);

      return ComparisonChain.start()
          .compare(this.time, rev.time)
          .compare(this.filename, rev.filename)
          .compare(this.user, rev.user)
          .compare(this.logmsg, rev.logmsg)
          .compare(this.transaction, rev.transaction)
          .compare(this.relName, rev.relName)
          .compare(this.hashCode(), rev.hashCode())
          .result();
    }
示例#28
0
  private int compareToAnotherHighCard(HighCardHandDescriptor other) {

    // create descending iterator
    Iterator<Rank> iRanks = this.ranks.descendingIterator();
    Iterator<Rank> iOtherRanks = other.ranks.descendingIterator();

    return ComparisonChain.start()
        .compare(iRanks.next(), iOtherRanks.next())
        .compare(iRanks.next(), iOtherRanks.next())
        .compare(iRanks.next(), iOtherRanks.next())
        .compare(iRanks.next(), iOtherRanks.next())
        .compare(iRanks.next(), iOtherRanks.next())
        .result();
  }
 protected ComparisonChain isAssignableProductName(
     DatabaseInfo databaseInfo, ComparisonChain comparator) {
   return comparator.compare(
       getProductName(),
       databaseInfo.getProductName(),
       new Ordering<String>() {
         @Override
         public int compare(String productName1, String productName2) {
           return productName1 == null
               ? 0
               : StringUtils.equals(productName1, productName2) ? ASSIGNABLE : NOT_ASSIGNABLE;
         }
       });
 }
 @Override
 public int compareKey(PointSensitivity other) {
   if (other instanceof SwaptionSensitivity) {
     SwaptionSensitivity otherSwpt = (SwaptionSensitivity) other;
     return ComparisonChain.start()
         .compare(currency, otherSwpt.currency)
         .compare(expiry, otherSwpt.expiry)
         .compare(tenor, otherSwpt.tenor)
         .compare(strike, otherSwpt.strike)
         .compare(forward, otherSwpt.forward)
         .compare(convention.toString(), otherSwpt.convention.toString())
         .result();
   }
   return getClass().getSimpleName().compareTo(other.getClass().getSimpleName());
 }