当前位置: 首页>>代码示例>>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;未经允许,请勿转载。