本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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));
}