Example usage for com.google.common.collect ComparisonChain start

List of usage examples for com.google.common.collect ComparisonChain start

Introduction

In this page you can find the example usage for com.google.common.collect ComparisonChain start.

Prototype

public static ComparisonChain start() 

Source Link

Document

Begins a new chained comparison statement.

Usage

From source file:org.spongepowered.common.data.manipulator.mutable.entity.SpongeFoodData.java

@Override
public int compareTo(FoodData o) {
    return ComparisonChain.start().compare(o.foodLevel().get().intValue(), this.foodLevel)
            .compare(o.saturation().get().floatValue(), this.foodSaturationLevel)
            .compare(o.exhaustion().get().floatValue(), this.foodExhaustionLevel).result();
}

From source file:com.facebook.buck.event.listener.CommonThreadStateRenderer.java

public ImmutableList<Long> getSortedThreadIds(boolean sortByTime) {
    Comparator<Long> comparator;
    if (sortByTime) {
        comparator = new Comparator<Long>() {
            private Comparator<Long> reverseOrdering = Ordering.natural().reverse();

            @Override/* w  ww .  java  2  s  .  com*/
            public int compare(Long threadId1, Long threadId2) {
                long elapsedTime1 = Preconditions.checkNotNull(threadInformationMap.get(threadId1))
                        .getElapsedTimeMs();
                long elapsedTime2 = Preconditions.checkNotNull(threadInformationMap.get(threadId2))
                        .getElapsedTimeMs();
                return ComparisonChain.start().compare(elapsedTime1, elapsedTime2, reverseOrdering)
                        .compare(threadId1, threadId2).result();
            }
        };
    } else {
        comparator = Ordering.natural();
    }
    return FluentIterable.from(threadInformationMap.keySet()).toSortedList(comparator);
}

From source file:com.github.nethad.clustermeister.api.Credentials.java

@Override
public int compareTo(Credentials o) {
    return ComparisonChain.start().compare(name, o.name).compare(user, o.user).result();
}

From source file:eu.lp0.cursus.db.data.RaceNumber.java

@Override
public int compareTo(RaceNumber o) {
    return ComparisonChain.start().compare(getOrganisation(), o.getOrganisation())
            .compare(getNumber(), o.getNumber()).compare(getSeries(), o.getSeries()).result();
}

From source file:de.tu_berlin.dima.oligos.type.util.ColumnId.java

@Override
public int compareTo(ColumnId other) {
    return ComparisonChain.start().compare(this.schema, other.schema).compare(this.table, other.table)
            .compare(this.column, other.column).result();
}

From source file:org.apache.mahout.graph.common.UndirectedEdgeWithDegrees.java

@Override
public int compareTo(UndirectedEdgeWithDegrees other) {
    return ComparisonChain.start().compare(first.vertex(), other.first.vertex())
            .compare(second.vertex(), other.second.vertex()).result();
}

From source file:org.apache.mahout.graph.model.UndirectedEdgeWithDegrees.java

@Override
public int compareTo(UndirectedEdgeWithDegrees other) {
    return ComparisonChain.start().compare(first.getVertex(), other.first.getVertex())
            .compare(second.getVertex(), other.second.getVertex()).result();
}

From source file:fm.last.musicbrainz.data.model.PartialDate.java

@Override
public int compareTo(PartialDate other) {
    Comparator<Short> comparator = Ordering.natural().nullsFirst();
    return ComparisonChain.start().compare(year, other.getYear(), comparator)
            .compare(month, other.getMonth(), comparator).compare(day, other.getDay(), comparator).result();
}

From source file:org.agatom.springatom.data.oid.creators.DefaultSOid.java

@Override
public int compareTo(@Nonnull final DefaultSOid o) {
    return ComparisonChain.start().compare(this.objectId, o.objectId)
            .compare(this.objectClass.getName(), o.objectClass.getName()).result();
}

From source file:eu.lp0.cursus.db.data.Class.java

@Override
public int compareTo(Class o) {
    return ComparisonChain.start().compare(getSeries(), o.getSeries()).compare(getName(), o.getName()).result();
}