diff --git a/jbit/README.textile b/jbit/README.textile index db9e502..047344b 100644 --- a/jbit/README.textile +++ b/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 ); + } diff --git a/jbit/src/main/java/com/github/kyleburton/JBit.java b/jbit/src/main/java/com/github/kyleburton/JBit.java deleted file mode 100644 index 79a8cb7..0000000 --- a/jbit/src/main/java/com/github/kyleburton/JBit.java +++ /dev/null @@ -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; - } -} diff --git a/jbit/src/test/java/com/github/kyleburton/JBitTest.java b/jbit/src/test/java/com/github/kyleburton/JBitTest.java deleted file mode 100644 index 565128e..0000000 --- a/jbit/src/test/java/com/github/kyleburton/JBitTest.java +++ /dev/null @@ -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); - } - -}