當前位置: 首頁>>代碼示例>>Java>>正文


Java ByteBuffer.compareTo方法代碼示例

本文整理匯總了Java中java.nio.ByteBuffer.compareTo方法的典型用法代碼示例。如果您正苦於以下問題:Java ByteBuffer.compareTo方法的具體用法?Java ByteBuffer.compareTo怎麽用?Java ByteBuffer.compareTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.nio.ByteBuffer的用法示例。


在下文中一共展示了ByteBuffer.compareTo方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: resolveRegular

import java.nio.ByteBuffer; //導入方法依賴的package包/類
public static Resolution resolveRegular(long leftTimestamp,
                                        boolean leftLive,
                                        int leftLocalDeletionTime,
                                        ByteBuffer leftValue,
                                        long rightTimestamp,
                                        boolean rightLive,
                                        int rightLocalDeletionTime,
                                        ByteBuffer rightValue)
{
    if (leftTimestamp != rightTimestamp)
        return leftTimestamp < rightTimestamp ? Resolution.RIGHT_WINS : Resolution.LEFT_WINS;

    if (leftLive != rightLive)
        return leftLive ? Resolution.RIGHT_WINS : Resolution.LEFT_WINS;

    int c = leftValue.compareTo(rightValue);
    if (c < 0)
        return Resolution.RIGHT_WINS;
    else if (c > 0)
        return Resolution.LEFT_WINS;

    // Prefer the longest ttl if relevant
    return leftLocalDeletionTime < rightLocalDeletionTime ? Resolution.RIGHT_WINS : Resolution.LEFT_WINS;
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:25,代碼來源:Conflicts.java

示例2: compareTo

import java.nio.ByteBuffer; //導入方法依賴的package包/類
@Override
public int compareTo(Object o) {
    if (this.equals(o)) {
        return 0;
    }

    if (o instanceof BgpFsDestinationPrefix) {
        BgpFsDestinationPrefix that = (BgpFsDestinationPrefix) o;

        if (this.ipPrefix().prefixLength() == that.ipPrefix().prefixLength()) {
            ByteBuffer value1 = ByteBuffer.wrap(this.ipPrefix.address().toOctets());
            ByteBuffer value2 = ByteBuffer.wrap(that.ipPrefix.address().toOctets());
            return value1.compareTo(value2);
        }

        if (this.ipPrefix().prefixLength() > that.ipPrefix().prefixLength()) {
            return 1;
        } else if (this.ipPrefix().prefixLength() < that.ipPrefix().prefixLength()) {
            return -1;
        }
    }
    return 1;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:24,代碼來源:BgpFsDestinationPrefix.java

示例3: compareTo

import java.nio.ByteBuffer; //導入方法依賴的package包/類
@Override
public int compareTo(Object o) {
    if (this.equals(o)) {
        return 0;
    }

    if (o instanceof BgpFsSourcePrefix) {
        BgpFsSourcePrefix that = (BgpFsSourcePrefix) o;

        if (this.ipPrefix().prefixLength() == that.ipPrefix().prefixLength()) {
            ByteBuffer value1 = ByteBuffer.wrap(this.ipPrefix.address().toOctets());
            ByteBuffer value2 = ByteBuffer.wrap(that.ipPrefix.address().toOctets());
            return value1.compareTo(value2);
        }

        if (this.ipPrefix().prefixLength() > that.ipPrefix().prefixLength()) {
            return 1;
        } else if (this.ipPrefix().prefixLength() < that.ipPrefix().prefixLength()) {
            return -1;
        }
    }
    return 1;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:24,代碼來源:BgpFsSourcePrefix.java

示例4: compareTo

import java.nio.ByteBuffer; //導入方法依賴的package包/類
@Override
public int compareTo(Object o) {
    if (this.equals(o)) {
        return 0;
    }
    ByteBuffer value1 = ByteBuffer.wrap(this.ipPrefix);
    ByteBuffer value2 = ByteBuffer.wrap(((IPReachabilityInformationTlv) o).ipPrefix);
    return value1.compareTo(value2);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:10,代碼來源:IPReachabilityInformationTlv.java

示例5: compareTo

import java.nio.ByteBuffer; //導入方法依賴的package包/類
@Override
public int compareTo(Object o) {
    if (this.equals(o)) {
        return 0;
    }
    ByteBuffer value1 = ByteBuffer.wrap(this.isoNodeID);
    ByteBuffer value2 = ByteBuffer.wrap(((IsIsNonPseudonode) o).isoNodeID);
    return value1.compareTo(value2);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:10,代碼來源:IsIsNonPseudonode.java

示例6: compareTo

import java.nio.ByteBuffer; //導入方法依賴的package包/類
@Override
public int compareTo(Object o) {
    if (this.equals(o)) {
        return 0;
    }
    ByteBuffer value1 = ByteBuffer.wrap(this.isoNodeID);
    ByteBuffer value2 = ByteBuffer.wrap(((IsIsPseudonode) o).isoNodeID);
    if (value1.compareTo(value2) != 0) {
        return value1.compareTo(value2);
    }
    return ((Byte) (this.psnIdentifier)).compareTo((Byte) (((IsIsPseudonode) o).psnIdentifier));
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:13,代碼來源:IsIsPseudonode.java


注:本文中的java.nio.ByteBuffer.compareTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。