Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

moved jbit out to its own project

  • Loading branch information...
commit 1c00e30e7e355ac8bba0bce6ba9733cfdb0beecc 1 parent 8b90f89
@rn-superg rn-superg authored
View
23 jbit/README.textile
@@ -1,3 +1,6 @@
+This has been moved out to it's own project: "JBit":https://github.com/kyleburton/jbit
+
+
h1. JBit
Bit set implementation to support arbitrariliy sized bit arrays natively in Java.
@@ -26,3 +29,23 @@ for use in Bloom filters with more than 2^32 bits - they are, by definition,
unable to set any bits above 2^32 which will result in a higher than expected
false positive rate for the filter, regardless of the number of hashes or making
the filter wider.
+
+
+
+New thoughts...
+
+Very Large (unbounded?) Java Bit Arrays
+
+Instead of going all the way down to using byte arrays - why not use an array
+of BitSets or BigIntegers? They already support all of the bit operations
+that we want. The only work the wrapper library would have to do then is
+bit-shifting work on the values being set.
+
+The Interface / usage might look like:
+
+ // NB: for now all I care about is get/set because that's all I need for the
+ // bloom filter
+ public interface LargeBitSet {
+ public boolean get( BigInteger bit );
+ public void set( BigInteger bit );
+ }
View
27 jbit/src/main/java/com/github/kyleburton/JBit.java
@@ -1,27 +0,0 @@
-package com.github.kyleburton;
-
-public class JBit {
- private long width = 0;
- private byte[][] bitArrays = null;
-
- public JBit ( long width ) {
- long basize1 = width / 8L;
- width = width % 8L;
- int basize2 = (int)(width / Integer.MAX_VALUE);
-
- System.out.println(String.format("width=%s; basize1=%s; basize2=%s",
- ""+width,
- ""+basize1,
- ""+basize2));
-
- bitArrays = new byte[basize2][];
- }
-
- public void set ( long bitNum ) {
- long baidx1 = bitNum / Integer.MAX_VALUE;
- bitNum = bitNum % Integer.MAX_VALUE;
- long baidx2 = bitNum / 8;
- long baoff = bitNum % 8;
- bitArrays[(int)baidx1][(int)baidx2] &= 1>>>(int)baoff;
- }
-}
View
15 jbit/src/test/java/com/github/kyleburton/JBitTest.java
@@ -1,15 +0,0 @@
-package com.github.kyleburton;
-
-public class JBitTest {
- //@Test
- public void testSet () {
- JBit bset = new JBit(256);
- //assertFalse bset.get(0);
- //assertFalse bset.get(1);
- //assertFalse bset.get(2);
- //assertFalse bset.get(3);
- //bset.set(255);
- //assertTrue bset.get(255);
- }
-
-}
Please sign in to comment.
Something went wrong with that request. Please try again.