本文整理汇总了Java中com.clearspring.analytics.hash.MurmurHash类的典型用法代码示例。如果您正苦于以下问题:Java MurmurHash类的具体用法?Java MurmurHash怎么用?Java MurmurHash使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MurmurHash类属于com.clearspring.analytics.hash包,在下文中一共展示了MurmurHash类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testSamplerSingleInsertionsEqualMulti
import com.clearspring.analytics.hash.MurmurHash; //导入依赖的package包/类
@Test
public void testSamplerSingleInsertionsEqualMulti() throws TimeoutException
{
TopKSampler<String> sampler = new TopKSampler<String>();
sampler.beginSampling(10);
insert(sampler);
waitForEmpty(1000);
SamplerResult single = sampler.finishSampling(10);
TopKSampler<String> sampler2 = new TopKSampler<String>();
sampler2.beginSampling(10);
for(int i = 1; i <= 10; i++)
{
String key = "item" + i;
sampler2.addSample(key, MurmurHash.hash64(key), i);
}
waitForEmpty(1000);
Assert.assertEquals(countMap(single.topK), countMap(sampler2.finishSampling(10).topK));
Assert.assertEquals(sampler2.hll.cardinality(), 10);
Assert.assertEquals(sampler.hll.cardinality(), sampler2.hll.cardinality());
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:22,代码来源:TopKSamplerTest.java
示例2: addObject
import com.clearspring.analytics.hash.MurmurHash; //导入依赖的package包/类
@Override
public void addObject(Object o) {
cardinality +=1;
if (o instanceof Long){
countMinSketch.add((Long)o, 1);
}else{
countMinSketch.add(MurmurHash.hash(o), 1);
}
updateHeavyHitters(o);
}
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:CountMinHeavyHitter.java
示例3: estimateCount
import com.clearspring.analytics.hash.MurmurHash; //导入依赖的package包/类
public long estimateCount(Object item){
if (item instanceof Long){
return countMinSketch.estimateCount((Long)item);
}else{
return countMinSketch.estimateCount(MurmurHash.hash(item));
}
}
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:CountMinHeavyHitter.java
示例4: insert
import com.clearspring.analytics.hash.MurmurHash; //导入依赖的package包/类
private void insert(TopKSampler<String> sampler)
{
for(int i = 1; i <= 10; i++)
{
for(int j = 0; j < i; j++)
{
String key = "item" + i;
sampler.addSample(key, MurmurHash.hash64(key), 1);
}
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:12,代码来源:TopKSamplerTest.java
示例5: getHashBuckets
import com.clearspring.analytics.hash.MurmurHash; //导入依赖的package包/类
int[] getHashBuckets(byte[] b, int hashCount, int max) {
int[] result = new int[hashCount];
int hash1 = MurmurHash.hash(b, b.length, 0);
int hash2 = MurmurHash.hash(b, b.length, hash1);
for (int i = 0; i < hashCount; i++) {
result[i] = Math.abs((hash1 + i * hash2) % max);
}
return result;
}
开发者ID:mintDS,项目名称:mintds,代码行数:10,代码来源:CountingBloomFilter.java
示例6: exec
import com.clearspring.analytics.hash.MurmurHash; //导入依赖的package包/类
@Override
public Tuple exec(Tuple input) throws IOException {
// Since Initial is guaranteed to be called
// only in the map, it will be called with an
// input of a bag with a single tuple - the
// count should always be 1 if bag is non empty
DataBag bag = (DataBag) input.get(0);
Iterator<Tuple> it = bag.iterator();
Tuple t = null;
if (it.hasNext()) {
t = (Tuple) it.next();
}
return mTupleFactory.newTuple((Object) MurmurHash.hash64(t));
}
开发者ID:apache,项目名称:incubator-datafu,代码行数:15,代码来源:HyperLogLogPlusPlus.java
示例7: offer
import com.clearspring.analytics.hash.MurmurHash; //导入依赖的package包/类
@Override
public boolean offer(Object o) {
final int x = MurmurHash.hash(o);
return offerHashed(x);
}
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:6,代码来源:HyperLogLog.java
注:本文中的com.clearspring.analytics.hash.MurmurHash类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论