public void receive(Boolean bit) { try { mMessage.add(bit); } catch (BitSetFullException e) { //e.printStackTrace(); } /* Once our message is complete (ie full), send it to all registered * message listeners, and set complete flag so for auto-removal */ if (mMessage.isFull()) { mComplete = true; flush(); } }
/** * Static method to construct a new BitSetBuffer, preloaded with the bits * from the preload parameter, and then filled with the bits from the * second bitsetbuffer parameter. * * @param preloadBits - boolean array of bits to be prepended to the new * bitset * @param bitsetToAppend - full bitset to be appended to the residual bits array * @return - new Bitset preloaded with residual bits and new bitset */ public static BitSetBuffer merge(bool[] preloadBits, BitSetBuffer bitsetToAppend) { BitSetBuffer returnValue = new BitSetBuffer(preloadBits.Length + bitsetToAppend.size(), preloadBits); int pointer = 0; while (pointer < bitsetToAppend.size() && !returnValue.isFull()) { try { returnValue.add(bitsetToAppend[pointer]); } catch (BitSetFullException e) { //e.printStackTrace(); } pointer++; } return(returnValue); }
/** * Static method to construct a new BitSetBuffer, preloaded with the bits * from the preload parameter, and then filled with the bits from the * second bitsetbuffer parameter. * * @param preloadBits - boolean array of bits to be prepended to the new * bitset * @param bitsetToAppend - full bitset to be appended to the residual bits array * @return - new Bitset preloaded with residual bits and new bitset */ public static BitSetBuffer merge( bool[] preloadBits, BitSetBuffer bitsetToAppend ) { BitSetBuffer returnValue = new BitSetBuffer( preloadBits.Length + bitsetToAppend.size(), preloadBits ); int pointer = 0; while( pointer < bitsetToAppend.size() && !returnValue.isFull() ) { try { returnValue.add( bitsetToAppend[pointer] ); } catch( BitSetFullException e ) { //e.printStackTrace(); } pointer++; } return returnValue; }