当前位置: 首页>>代码示例>>Java>>正文


Java FBUtilities.midpoint方法代码示例

本文整理汇总了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);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:10,代码来源:RandomPartitioner.java

示例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));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:10,代码来源:OrderPreservingPartitioner.java

示例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));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:13,代码来源:AbstractByteOrderedPartitioner.java

示例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));
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:34,代码来源:AbstractByteOrderedPartitioner.java

示例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);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:10,代码来源:LengthPartitioner.java


注:本文中的org.apache.cassandra.utils.FBUtilities.midpoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。