forked from I2P_Developers/i2p.i2p
xlattice findbugs
This commit is contained in:
@@ -45,16 +45,16 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class BloomSHA1 {
|
public class BloomSHA1 {
|
||||||
protected final int m;
|
private final int m;
|
||||||
protected final int k;
|
private final int k;
|
||||||
protected int count;
|
private int count;
|
||||||
|
|
||||||
protected final int[] filter;
|
private final int[] filter;
|
||||||
protected final KeySelector ks;
|
private final KeySelector ks;
|
||||||
|
|
||||||
// convenience variables
|
// convenience variables
|
||||||
protected final int filterBits;
|
private final int filterBits;
|
||||||
protected final int filterWords;
|
private final int filterWords;
|
||||||
|
|
||||||
private final BlockingQueue<int[]> buf;
|
private final BlockingQueue<int[]> buf;
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ public class BloomSHA1 {
|
|||||||
this (20, 8);
|
this (20, 8);
|
||||||
}
|
}
|
||||||
/** Clear the filter, unsynchronized */
|
/** Clear the filter, unsynchronized */
|
||||||
protected void doClear() {
|
private void doClear() {
|
||||||
Arrays.fill(filter, 0);
|
Arrays.fill(filter, 0);
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
@@ -186,9 +186,9 @@ public class BloomSHA1 {
|
|||||||
* @param b byte array representing a key (SHA1 digest)
|
* @param b byte array representing a key (SHA1 digest)
|
||||||
* @return true if b is in the filter
|
* @return true if b is in the filter
|
||||||
*/
|
*/
|
||||||
protected final boolean isMember(byte[] b) { return isMember(b, 0, b.length); }
|
private final boolean isMember(byte[] b) { return isMember(b, 0, b.length); }
|
||||||
|
|
||||||
protected final boolean isMember(byte[] b, int offset, int len) {
|
private final boolean isMember(byte[] b, int offset, int len) {
|
||||||
int[] bitOffset = acquire();
|
int[] bitOffset = acquire();
|
||||||
int[] wordOffset = acquire();
|
int[] wordOffset = acquire();
|
||||||
ks.getOffsets(b, offset, len, bitOffset, wordOffset);
|
ks.getOffsets(b, offset, len, bitOffset, wordOffset);
|
||||||
|
@@ -40,14 +40,14 @@ public class KeySelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** AND with byte to expose index-many bits */
|
/** AND with byte to expose index-many bits */
|
||||||
public final static int[] UNMASK = {
|
private final static int[] UNMASK = {
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||||
0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767};
|
0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767};
|
||||||
/** AND with byte to zero out index-many bits */
|
/** AND with byte to zero out index-many bits */
|
||||||
public final static int[] MASK = {
|
private final static int[] MASK = {
|
||||||
~0,~1,~3,~7,~15,~31,~63,~127,~255,~511,~1023,~2047,~4095,~8191,~16383,~32767};
|
~0,~1,~3,~7,~15,~31,~63,~127,~255,~511,~1023,~2047,~4095,~8191,~16383,~32767};
|
||||||
|
|
||||||
public final static int TWO_UP_15 = 32 * 1024;
|
private final static int TWO_UP_15 = 32 * 1024;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a key selector for a Bloom filter. When a key is presented
|
* Creates a key selector for a Bloom filter. When a key is presented
|
||||||
|
Reference in New Issue
Block a user