Example usage for com.google.common.primitives Longs compare

List of usage examples for com.google.common.primitives Longs compare

Introduction

In this page you can find the example usage for com.google.common.primitives Longs compare.

Prototype

public static int compare(long a, long b) 

Source Link

Document

Compares the two specified long values.

Usage

From source file:org.apache.cassandra.db.index.sasi.disk.Token.java

@Override
public int compareTo(CombinedValue<Long> o) {
    return Longs.compare(token, ((Token) o).token);
}

From source file:org.apache.cassandra.index.sasi.disk.Token.java

public int compareTo(CombinedValue<Long> o) {
    return Longs.compare(token, ((Token) o).token);
}

From source file:org.apache.druid.query.ResultGranularTimestampComparator.java

@Override
public int compare(Result<T> r1, Result<T> r2) {
    return Longs.compare(gran.bucketStart(r1.getTimestamp()).getMillis(),
            gran.bucketStart(r2.getTimestamp()).getMillis());
}

From source file:de.cosmocode.palava.workqueue.DelayedElement.java

@Override
public int compareTo(Delayed that) {
    return Longs.compare(getDelay(TimeUnit.MILLISECONDS), that.getDelay(TimeUnit.MILLISECONDS));
}

From source file:org.apache.hbase.cell.CellComparator.java

public static int compareStatic(Cell a, Cell b) {
    //row/*from   w  w w .j a  v a  2 s  .co  m*/
    int c = Bytes.compareTo(a.getRowArray(), a.getRowOffset(), a.getRowLength(), b.getRowArray(),
            b.getRowOffset(), b.getRowLength());
    if (c != 0)
        return c;

    //family
    c = Bytes.compareTo(a.getFamilyArray(), a.getFamilyOffset(), a.getFamilyLength(), b.getFamilyArray(),
            b.getFamilyOffset(), b.getFamilyLength());
    if (c != 0)
        return c;

    //qualifier
    c = Bytes.compareTo(a.getQualifierArray(), a.getQualifierOffset(), a.getQualifierLength(),
            b.getQualifierArray(), b.getQualifierOffset(), b.getQualifierLength());
    if (c != 0)
        return c;

    //timestamp: later sorts first
    c = -Longs.compare(a.getTimestamp(), b.getTimestamp());
    if (c != 0)
        return c;

    //type
    c = (0xff & a.getTypeByte()) - (0xff & b.getTypeByte());
    if (c != 0)
        return c;

    //mvccVersion: later sorts first
    return -Longs.compare(a.getMvccVersion(), b.getMvccVersion());
}

From source file:org.n52.iceland.util.Comparables.java

public static int compare(long x, long y) {
    return Longs.compare(x, y);
}

From source file:com.b2international.snowowl.snomed.reasoner.server.diff.relationship.StatementFragmentOrdering.java

@Override
public int compare(final StatementFragment o1, final StatementFragment o2) {

    final int attributeDelta = Longs.compare(o1.getTypeId(), o2.getTypeId());
    if (attributeDelta != 0)
        return attributeDelta;

    final int valueDelta = Longs.compare(o1.getDestinationId(), o2.getDestinationId());
    if (valueDelta != 0)
        return valueDelta;

    final int groupDelta = o1.getGroup() - o2.getGroup();
    if (groupDelta != 0)
        return groupDelta;

    final int unionGroupDelta = o1.getUnionGroup() - o2.getUnionGroup();
    if (unionGroupDelta != 0)
        return unionGroupDelta;

    final int isUniversalDelta = Booleans.compare(o1.isUniversal(), o2.isUniversal());
    if (isUniversalDelta != 0)
        return isUniversalDelta;

    final int isDestinationNegatedDelta = Booleans.compare(o1.isDestinationNegated(),
            o2.isDestinationNegated());//from  ww  w . ja v a2s  . co m
    return isDestinationNegatedDelta;
}

From source file:com.ibm.common.activitystreams.internal.LazilyParsedNumberComparable.java

/**
 * Method compareTo.
 * @param o Number
 * @return int
 */
public int compareTo(Number o) {
    return Longs.compare(inner.longValue(), o.longValue());
}

From source file:org.immutables.mongo.types.TimeInstant.java

@Override
public int compareTo(TimeInstant that) {
    return Longs.compare(value, that.value);
}

From source file:co.cask.cdap.logging.write.LogWriteEvent.java

@Override
public int compareTo(LogWriteEvent event) {
    return Longs.compare(logEvent.getTimeStamp(), event.getLogEvent().getTimeStamp());
}