public static EWAHCompressedBitmap32 xor ( final EWAHCompressedBitmap32 ... bitmaps ) { PriorityQueue < EWAHCompressedBitmap32 > pq = new PriorityQueue < EWAHCompressedBitmap32 > ( bitmaps . length , new Comparator < EWAHCompressedBitmap32 > ( ) { @ Override public int compare ( EWAHCompressedBitmap32 a , EWAHCompressedBitmap32 b ) { return a . sizeInBytes ( ) - b . sizeInBytes ( ) ; } } ) ; Collections . addAll ( pq , bitmaps ) ; if ( pq . isEmpty ( ) ) return new EWAHCompressedBitmap32 ( ) ; while ( pq . size ( ) > 1 ) { EWAHCompressedBitmap32 x1 = pq . poll ( ) ; EWAHCompressedBitmap32 x2 = pq . poll ( ) ; pq . add ( x1 . xor ( x2 ) ) ; } return pq . poll ( ) ; }
Simple algorithm that computes the XOR aggregate .