本文整理汇总了Java中org.apache.cassandra.utils.FBUtilities.midpoint方法的典型用法代码示例。如果您正苦于以下问题:Java FBUtilities.midpoint方法的具体用法?Java FBUtilities.midpoint怎么用?Java FBUtilities.midpoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.utils.FBUtilities
的用法示例。
在下文中一共展示了FBUtilities.midpoint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: midpoint
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public Token midpoint(Token ltoken, Token rtoken)
{
// the symbolic MINIMUM token should act as ZERO: the empty bit array
BigInteger left = ltoken.equals(MINIMUM) ? ZERO : ((BigIntegerToken)ltoken).token;
BigInteger right = rtoken.equals(MINIMUM) ? ZERO : ((BigIntegerToken)rtoken).token;
Pair<BigInteger,Boolean> midpair = FBUtilities.midpoint(left, right, 127);
// discard the remainder
return new BigIntegerToken(midpair.left);
}
示例2: midpoint
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public StringToken midpoint(Token ltoken, Token rtoken)
{
int sigchars = Math.max(((StringToken)ltoken).token.length(), ((StringToken)rtoken).token.length());
BigInteger left = bigForString(((StringToken)ltoken).token, sigchars);
BigInteger right = bigForString(((StringToken)rtoken).token, sigchars);
Pair<BigInteger,Boolean> midpair = FBUtilities.midpoint(left, right, 16*sigchars);
return new StringToken(stringForBig(midpair.left, sigchars, midpair.right));
}
示例3: midpoint
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public BytesToken midpoint(Token lt, Token rt)
{
BytesToken ltoken = (BytesToken) lt;
BytesToken rtoken = (BytesToken) rt;
int sigbytes = Math.max(ltoken.token.length, rtoken.token.length);
BigInteger left = bigForBytes(ltoken.token, sigbytes);
BigInteger right = bigForBytes(rtoken.token, sigbytes);
Pair<BigInteger,Boolean> midpair = FBUtilities.midpoint(left, right, 8*sigbytes);
return new BytesToken(bytesForBig(midpair.left, sigbytes, midpair.right));
}
示例4: midpoint
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public BytesToken midpoint(Token ltoken, Token rtoken)
{
int ll,rl;
ByteBuffer lb,rb;
if(ltoken.token instanceof byte[])
{
ll = ((byte[])ltoken.token).length;
lb = ByteBuffer.wrap(((byte[])ltoken.token));
}
else
{
ll = ((ByteBuffer)ltoken.token).remaining();
lb = (ByteBuffer)ltoken.token;
}
if(rtoken.token instanceof byte[])
{
rl = ((byte[])rtoken.token).length;
rb = ByteBuffer.wrap(((byte[])rtoken.token));
}
else
{
rl = ((ByteBuffer)rtoken.token).remaining();
rb = (ByteBuffer)rtoken.token;
}
int sigbytes = Math.max(ll, rl);
BigInteger left = bigForBytes(lb, sigbytes);
BigInteger right = bigForBytes(rb, sigbytes);
Pair<BigInteger,Boolean> midpair = FBUtilities.midpoint(left, right, 8*sigbytes);
return new BytesToken(bytesForBig(midpair.left, sigbytes, midpair.right));
}
示例5: midpoint
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public BigIntegerToken midpoint(Token ltoken, Token rtoken)
{
// the symbolic MINIMUM token should act as ZERO: the empty bit array
BigInteger left = ltoken.equals(MINIMUM) ? ZERO : ((BigIntegerToken)ltoken).token;
BigInteger right = rtoken.equals(MINIMUM) ? ZERO : ((BigIntegerToken)rtoken).token;
Pair<BigInteger,Boolean> midpair = FBUtilities.midpoint(left, right, 127);
// discard the remainder
return new BigIntegerToken(midpair.left);
}