private static void promoteSparseToWindowed ( final CpcSketch sketch ) { final int lgK = sketch . lgK ; final int k = ( 1 << lgK ) ; final long c32 = sketch . numCoupons << 5 ; assert ( ( c32 == ( 3 * k ) ) || ( ( lgK == 4 ) && ( c32 > ( 3 * k ) ) ) ) ; final byte [ ] window = new byte [ k ] ; final PairTable newTable = new PairTable ( 2 , 6 + lgK ) ; final PairTable oldTable = sketch . pairTable ; final int [ ] oldSlots = oldTable . getSlotsArr ( ) ; final int oldNumSlots = ( 1 << oldTable . getLgSizeInts ( ) ) ; assert ( sketch . windowOffset == 0 ) ; for ( int i = 0 ; i < oldNumSlots ; i ++ ) { final int rowCol = oldSlots [ i ] ; if ( rowCol != - 1 ) { final int col = rowCol & 63 ; if ( col < 8 ) { final int row = rowCol >>> 6 ; window [ row ] |= ( 1 << col ) ; } else { // cannot use Table.mustInsert(), because it doesn't provide for growth final boolean isNovel = PairTable . maybeInsert ( newTable , rowCol ) ; assert ( isNovel == true ) ; } } } assert ( sketch . slidingWindow == null ) ; sketch . slidingWindow = window ; sketch . pairTable = newTable ; }
In terms of flavor this promotes SPARSE to HYBRID .