List of usage examples for com.google.common.collect ComparisonChain start
public static ComparisonChain start()
From source file:org.n52.iceland.ogc.sos.CapabilitiesExtensionKey.java
@Override public int compareTo(CapabilitiesExtensionKey o) { return ComparisonChain.start().compare(getService(), o.getService()).compare(getVersion(), o.getVersion()) .result();//from ww w . j a v a 2 s .c o m }
From source file:org.apache.jackrabbit.oak.segment.MapEntry.java
@Override public int compareTo(MapEntry that) { return ComparisonChain.start().compare(getHash() & HASH_MASK, that.getHash() & HASH_MASK) .compare(name, that.name).compare(value, that.value).result(); }
From source file:org.graylog2.messageprocessors.MessageFilterChainProcessor.java
@Inject public MessageFilterChainProcessor(MetricRegistry metricRegistry, Set<MessageFilter> filterRegistry, Journal journal, ServerStatus serverStatus) { this.metricRegistry = metricRegistry; this.journal = journal; this.serverStatus = serverStatus; // we need to keep this sorted properly, so that the filters run in the correct order this.filterRegistry = Ordering.from(new Comparator<MessageFilter>() { @Override//from w w w . jav a 2 s .c om public int compare(MessageFilter filter1, MessageFilter filter2) { return ComparisonChain.start().compare(filter1.getPriority(), filter2.getPriority()) .compare(filter1.getName(), filter2.getName()).result(); } }).immutableSortedCopy(filterRegistry); if (filterRegistry.size() == 0) throw new RuntimeException("Empty filter registry!"); this.filteredOutMessages = metricRegistry.meter(name(ProcessBufferProcessor.class, "filteredOutMessages")); }
From source file:org.pircbotx.hooks.Event.java
/** * Compare events by {@link #getTimestamp()} and then {@link #getId()} to * order by when they are received. This is useful for sorting lists of * Channel objects.//from ww w. ja v a 2s. c o m * * @param other Other Event to compare to * @return the result of the comparison */ public int compareTo(Event other) { ComparisonChain comparison = ComparisonChain.start().compare(getTimestamp(), other.getTimestamp()) .compare(getId(), other.getId()); if (bot != null && other.getBot() != null) comparison.compare(bot.getBotId(), other.getBot().getBotId()); return comparison.result(); }
From source file:org.spongepowered.common.data.manipulator.immutable.ImmutableSpongeTargetedLocationData.java
@Override public int compareTo(ImmutableTargetedLocationData o) { return ComparisonChain.start() .compare(o.get(Keys.TARGETED_LOCATION).get().getPosition(), this.getValue().getPosition()) .compare(o.get(Keys.TARGETED_LOCATION).get().getExtent().getName(), this.getValue().getExtent().getName()) .result();// w w w.j a v a 2s.c o m }
From source file:io.dockstore.webservice.core.WorkflowVersion.java
@Override public int compareTo(WorkflowVersion that) { if (super.compareTo(that) < 0) { return -1; } else if (super.compareTo(that) > 0) { return 1; }/*from w w w. ja v a 2 s . c om*/ return ComparisonChain.start().compare(this.workflowPath, that.workflowPath, Ordering.natural().nullsLast()) .result(); }
From source file:net.ljcomputing.team.domain.Team.java
/** * @see java.lang.Comparable#compareTo(java.lang.Object) */// w w w . j av a 2 s . co m @Override public int compareTo(Team o) { return ComparisonChain.start().compare(Strings.nullToEmpty(this.name), Strings.nullToEmpty(o.name)) .result(); }
From source file:io.crate.metadata.FunctionIdent.java
@Override public int compareTo(FunctionIdent o) { return ComparisonChain.start().compare(name, o.name) .compare(argumentTypes, o.argumentTypes, Ordering.<DataType>natural().lexicographical()).result(); }
From source file:me.yanaga.opes.Cep.java
@Override public int compareTo(Cep o) { return ComparisonChain.start().compare(this.value, o.value).result(); }
From source file:de.tuberlin.uebb.jdae.llmsl.GlobalVariable.java
@Override public int compareTo(GlobalVariable that) { return ComparisonChain.start().compare(index, that.index).compare(der, that.der).result(); }