本文整理匯總了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));
}