mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -22,6 +22,7 @@ public interface BitMap{
|
||||
* 检查是否包含值
|
||||
*
|
||||
* @param i 值
|
||||
* @return 是否包含
|
||||
*/
|
||||
boolean contains(long i);
|
||||
|
||||
@@ -30,5 +31,5 @@ public interface BitMap{
|
||||
*
|
||||
* @param i 值
|
||||
*/
|
||||
public void remove(long i);
|
||||
void remove(long i);
|
||||
}
|
@@ -11,7 +11,7 @@ import java.io.Serializable;
|
||||
public class IntMap implements BitMap, Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int[] ints = null;
|
||||
private int[] ints;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
@@ -40,10 +40,7 @@ public class IntMap implements BitMap, Serializable {
|
||||
public boolean contains(long i) {
|
||||
int r = (int) (i / BitMap.MACHINE32);
|
||||
int c = (int) (i % BitMap.MACHINE32);
|
||||
if (((int) ((ints[r] >>> c)) & 1) == 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return ((int) ((ints[r] >>> c)) & 1) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -11,7 +11,7 @@ import java.io.Serializable;
|
||||
public class LongMap implements BitMap, Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private long[] longs = null;
|
||||
private long[] longs;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
@@ -40,10 +40,7 @@ public class LongMap implements BitMap, Serializable {
|
||||
public boolean contains(long i) {
|
||||
int r = (int) (i / BitMap.MACHINE64);
|
||||
long c = i % BitMap.MACHINE64;
|
||||
if (((longs[r] >>> c) & 1) == 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return ((longs[r] >>> c) & 1) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -4,20 +4,20 @@ import cn.hutool.core.util.HashUtil;
|
||||
|
||||
/**
|
||||
* 默认Bloom过滤器,使用Java自带的Hash算法
|
||||
* @author loolly
|
||||
*
|
||||
* @author loolly
|
||||
*/
|
||||
public class DefaultFilter extends AbstractFilter {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public DefaultFilter(long maxValue, int MACHINENUM) {
|
||||
super(maxValue, MACHINENUM);
|
||||
public DefaultFilter(long maxValue, int machineNumber) {
|
||||
super(maxValue, machineNumber);
|
||||
}
|
||||
|
||||
|
||||
public DefaultFilter(long maxValue) {
|
||||
super(maxValue);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long hash(String str) {
|
||||
return HashUtil.javaDefaultHash(str) % size;
|
||||
|
@@ -5,8 +5,8 @@ import cn.hutool.core.util.HashUtil;
|
||||
public class ELFFilter extends AbstractFilter {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ELFFilter(long maxValue, int MACHINENUM) {
|
||||
super(maxValue, MACHINENUM);
|
||||
public ELFFilter(long maxValue, int machineNumber) {
|
||||
super(maxValue, machineNumber);
|
||||
}
|
||||
|
||||
public ELFFilter(long maxValue) {
|
||||
|
Reference in New Issue
Block a user