public abstract class AbstractFilter extends Object implements BloomFilter
| Modifier and Type | Field and Description |
|---|---|
protected static int |
DEFAULT_MACHINE_NUM |
protected long |
size |
| Constructor and Description |
|---|
AbstractFilter(long maxValue)
构造32位
|
AbstractFilter(long maxValue,
int machineNum)
构造
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(String str)
在boolean的bitMap中增加一个字符串
如果存在就返回 false .如果不存在.先增加这个字符串.再返回true |
boolean |
contains(String str) |
abstract long |
hash(String str)
自定义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 str)
contains in interface BloomFilterstr - 字符串public boolean add(String str)
BloomFilterfalse .如果不存在.先增加这个字符串.再返回trueadd in interface BloomFilterstr - 字符串false .如果不存在返回truepublic abstract long hash(String str)
str - 字符串Copyright © 2025. All rights reserved.