public abstract class AbstractFilter extends Object implements BloomFilter
| Modifier and Type | Field and Description |
|---|---|
protected long |
size |
| Constructor and Description |
|---|
AbstractFilter(long maxValue)
构造32位
|
AbstractFilter(long maxValue,
int machineNum)
构造
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(String text)
在boolean的bitMap中增加一个字符串
如果存在就返回
false如果不存在先增加这个字符串.再返回true |
boolean |
contains(String text) |
abstract long |
hash(String text)
自定义Hash方法
|
void |
init(long maxValue,
int machineNum)
初始化
|
public AbstractFilter(long maxValue,
int machineNum)
maxValue - 最大值machineNum - 机器位数public AbstractFilter(long maxValue)
maxValue - 最大值public void init(long maxValue,
int machineNum)
maxValue - 最大值machineNum - 机器位数public boolean contains(String text)
contains in interface BloomFiltertext - 字符串public boolean add(String text)
BloomFilterfalse如果不存在先增加这个字符串.再返回trueadd in interface BloomFiltertext - 字符串false如果不存在返回truepublic abstract long hash(String text)
text - 字符串Copyright © 2022. All rights reserved.