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.n52.iceland.ogc.ows.extension.OwsCapabilitiesExtensionKey.java

@Override
public int compareTo(OwsCapabilitiesExtensionKey o) {
    return ComparisonChain.start().compare(getService(), o.getService()).compare(getVersion(), o.getVersion())
            .result();// ww  w . ja  v  a2 s.c o  m
}

From source file:com.facebook.buck.rules.ExplicitBuildTargetSourcePath.java

@Override
public int compareTo(SourcePath other) {
    if (other == this) {
        return 0;
    }/*from w  w w.ja v a 2 s  . c  o m*/

    int classComparison = compareClasses(other);
    if (classComparison != 0) {
        return classComparison;
    }

    ExplicitBuildTargetSourcePath that = (ExplicitBuildTargetSourcePath) other;

    return ComparisonChain.start().compare(getTarget(), that.getTarget())
            .compare(resolvedPath, that.resolvedPath).result();
}

From source file:org.corpus_tools.peppermodules.annis.resolver.QName.java

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

From source file:uk.co.caprica.mediascanner.domain.MediaTitle.java

@Override
public int compareTo(MediaTitle o) {
    return ComparisonChain.start().compare(title, o.title).compare(year.or(-1), o.year.or(-1)).result();
}

From source file:com.verily.genomewarp.utils.GenomeRange.java

@Override
public int compareTo(GenomeRange range) {
    return ComparisonChain.start().compare(chromosome, range.chromosome).compare(start, range.start)
            .compare(end, range.end).compare(isPositiveStrand, range.isPositiveStrand()).result();
}

From source file:eu.project.ttc.utils.TermSuiteUtils.java

public static <T> LinkedHashMap<T, Integer> getCounters(Iterable<T> list) {
    Comparator<Entry<T, MutableInt>> comparator = new Comparator<Entry<T, MutableInt>>() {
        public int compare(Entry<T, MutableInt> o1, Entry<T, MutableInt> o2) {
            return ComparisonChain.start().compare(o2.getValue(), o1.getValue()).result();
        };/*from   ww w  .j ava2 s.  c o  m*/
    };

    Map<T, MutableInt> map = Maps.newHashMap();
    for (T e : list) {
        MutableInt counter = map.get(e);
        if (counter == null) {
            counter = new MutableInt(0);
            map.put(e, counter);
        }
        counter.increment();
    }
    List<Entry<T, MutableInt>> entries = Lists.newArrayList(map.entrySet());
    Collections.sort(entries, comparator);
    LinkedHashMap<T, Integer> counters = Maps.newLinkedHashMap();
    for (Entry<T, MutableInt> e : entries)
        counters.put(e.getKey(), e.getValue().intValue());
    return counters;
}

From source file:uk.co.caprica.brue.core.domain.bridge.Group.java

@Override
public int compareTo(Group another) {
    return ComparisonChain.start().compare(name, another.name, Ordering.natural().nullsLast())
            .compare(type, another.type).result();
}

From source file:monasca.common.hibernate.type.BinaryId.java

@Override
public int compareTo(@Nonnull final BinaryId binaryId) {
    return ComparisonChain.start().compare(this.toString(), binaryId.toString()).result();
}

From source file:gg.pistol.sweeper.core.DuplicateGroup.java

/**
 * Order descending by size./*from   w  ww.j  a v  a2  s  .c  om*/
 */
public int compareTo(DuplicateGroup other) {
    Preconditions.checkNotNull(other);
    return ComparisonChain.start().compare(size, other.getSize(), Ordering.natural().reverse())
            .compare(hash, other.hash).result();
}

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

@Override
public int compareTo(Edge other) {
    return ComparisonChain.start().compare(start, other.start).compare(end, other.end).result();
}