/** * For internal use. Computes the bitwise and of the provided bitmaps * and stores the result in the container. * * The content of the container is overwritten. * * @param container where the result is stored * @param bitmaps bitmaps to AND */ public static void andWithContainer(final BitmapStorage32 container, final EWAHCompressedBitmap32... bitmaps) { if (bitmaps.length == 1) throw new IllegalArgumentException( "Need at least one bitmap"); if (bitmaps.length == 2) { bitmaps[0].andToContainer(bitmaps[1], container); return; } int initialSize = calculateInitialSize(bitmaps); EWAHCompressedBitmap32 answer = new EWAHCompressedBitmap32(initialSize); EWAHCompressedBitmap32 tmp = new EWAHCompressedBitmap32(initialSize); bitmaps[0].andToContainer(bitmaps[1], answer); for (int k = 2; k < bitmaps.length - 1; ++k) { answer.andToContainer(bitmaps[k], tmp); tmp.swap(answer); tmp.clear(); } answer.andToContainer(bitmaps[bitmaps.length - 1], container); }
/** * For internal use. Computes the bitwise and of the provided bitmaps * and stores the result in the container. * * The content of the container is overwritten. * * @param container where the result is stored * @param bitmaps bitmaps to AND */ public static void andWithContainer(final BitmapStorage32 container, final EWAHCompressedBitmap32... bitmaps) { if (bitmaps.length == 1) throw new IllegalArgumentException( "Need at least one bitmap"); if (bitmaps.length == 2) { bitmaps[0].andToContainer(bitmaps[1], container); return; } int initialSize = calculateInitialSize(bitmaps); EWAHCompressedBitmap32 answer = new EWAHCompressedBitmap32(initialSize); EWAHCompressedBitmap32 tmp = new EWAHCompressedBitmap32(initialSize); bitmaps[0].andToContainer(bitmaps[1], answer); for (int k = 2; k < bitmaps.length - 1; ++k) { answer.andToContainer(bitmaps[k], tmp); tmp.swap(answer); tmp.clear(); } answer.andToContainer(bitmaps[bitmaps.length - 1], container); }
if (bitmaps.length == 2) return bitmaps[0].and(bitmaps[1]); int initialSize = calculateInitialSize(bitmaps); EWAHCompressedBitmap32 answer = new EWAHCompressedBitmap32(initialSize); EWAHCompressedBitmap32 tmp = new EWAHCompressedBitmap32(initialSize);
if (bitmaps.length == 2) return bitmaps[0].and(bitmaps[1]); int initialSize = calculateInitialSize(bitmaps); EWAHCompressedBitmap32 answer = new EWAHCompressedBitmap32(initialSize); EWAHCompressedBitmap32 tmp = new EWAHCompressedBitmap32(initialSize);