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


Java MurmurHash类代码示例

本文整理汇总了Java中org.apache.cassandra.utils.MurmurHash的典型用法代码示例。如果您正苦于以下问题:Java MurmurHash类的具体用法?Java MurmurHash怎么用?Java MurmurHash使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MurmurHash类属于org.apache.cassandra.utils包,在下文中一共展示了MurmurHash类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getToken

import org.apache.cassandra.utils.MurmurHash; //导入依赖的package包/类
/**
 * Generate the token of a key.
 * Note that we need to ensure all generated token are strictly bigger than MINIMUM.
 * In particular we don't want MINIMUM to correspond to any key because the range (MINIMUM, X] doesn't
 * include MINIMUM but we use such range to select all data whose token is smaller than X.
 */
public LongToken getToken(ByteBuffer key)
{
    if (key.remaining() == 0)
        return MINIMUM;

    long[] hash = new long[2];
    MurmurHash.hash3_x64_128(key, key.position(), key.remaining(), 0, hash);
    return new LongToken(normalize(hash[0]));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:16,代码来源:Murmur3Partitioner.java

示例2: GeneratorConfig

import org.apache.cassandra.utils.MurmurHash; //导入依赖的package包/类
public GeneratorConfig(String seedStr, DistributionFactory clusteringDistributions, DistributionFactory sizeDistributions, DistributionFactory identityDistributions)
{
    this.clusteringDistributions = clusteringDistributions;
    this.sizeDistributions = sizeDistributions;
    this.identityDistributions = identityDistributions;
    ByteBuffer buf = ByteBufferUtil.bytes(seedStr);
    long[] hash = new long[2];
    MurmurHash.hash3_x64_128(buf, buf.position(), buf.remaining(), 0, hash);
    salt = hash[0];
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:11,代码来源:GeneratorConfig.java

示例3: getToken

import org.apache.cassandra.utils.MurmurHash; //导入依赖的package包/类
/**
 * Generate the token of a key.
 * Note that we need to ensure all generated token are strictly bigger than MINIMUM.
 * In particular we don't want MINIMUM to correspond to any key because the range (MINIMUM, X] doesn't
 * include MINIMUM but we use such range to select all data whose token is smaller than X.
 */
public LongToken getToken(ByteBuffer key)
{
    if (key.remaining() == 0)
        return MINIMUM;

    long hash = MurmurHash.hash3_x64_128(key, key.position(), key.remaining(), 0)[0];
    return new LongToken(normalize(hash));
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:15,代码来源:Murmur3Partitioner.java

示例4: dk

import org.apache.cassandra.utils.MurmurHash; //导入依赖的package包/类
private static DecoratedKey dk(Long token)
{
    ByteBuffer buf = ByteBuffer.allocate(8);
    buf.putLong(token);
    buf.flip();
    Long hashed = MurmurHash.hash2_64(buf, buf.position(), buf.remaining(), 0);
    return new DecoratedKey(new LongToken(hashed), buf);
}
 
开发者ID:xedin,项目名称:sasi,代码行数:9,代码来源:TokenTreeTest.java

示例5: getHash

import org.apache.cassandra.utils.MurmurHash; //导入依赖的package包/类
private long[] getHash(ByteBuffer key)
{
    long[] hash = new long[2];
    MurmurHash.hash3_x64_128(key, key.position(), key.remaining(), 0, hash);
    return hash;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:7,代码来源:Murmur3Partitioner.java

示例6: filterHash

import org.apache.cassandra.utils.MurmurHash; //导入依赖的package包/类
public void filterHash(long[] dest)
{
    ByteBuffer key = getKey();
    MurmurHash.hash3_x64_128(key, key.position(), key.remaining(), 0, dest);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:6,代码来源:DecoratedKey.java

示例7: addKey

import org.apache.cassandra.utils.MurmurHash; //导入依赖的package包/类
public MetadataCollector addKey(ByteBuffer key)
{
    long hashed = MurmurHash.hash2_64(key, key.position(), key.remaining(), 0);
    cardinality.offerHashed(hashed);
    return this;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:7,代码来源:MetadataCollector.java

示例8: keyAt

import org.apache.cassandra.utils.MurmurHash; //导入依赖的package包/类
private static DecoratedKey keyAt(long rawKey)
{
    ByteBuffer key = ByteBuffer.wrap(("key" + rawKey).getBytes());
    return new DecoratedKey(new LongToken(MurmurHash.hash2_64(key, key.position(), key.remaining(), 0)), key);
}
 
开发者ID:xedin,项目名称:sasi,代码行数:6,代码来源:OnDiskIndexTest.java

示例9: addKey

import org.apache.cassandra.utils.MurmurHash; //导入依赖的package包/类
public void addKey(ByteBuffer key)
{
    long hashed = MurmurHash.hash2_64(key, key.position(), key.remaining(), 0);
    cardinality.offerHashed(hashed);
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:6,代码来源:MetadataCollector.java


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