private static void compressHybridFlavor ( final CompressedState target , final CpcSketch source ) { final int srcK = 1 << source . lgK ; final PairTable srcPairTable = source . pairTable ; final int srcNumPairs = srcPairTable . getNumPairs ( ) ; final int [ ] srcPairArr = PairTable . unwrappingGetItems ( srcPairTable , srcNumPairs ) ; introspectiveInsertionSort ( srcPairArr , 0 , srcNumPairs - 1 ) ; final byte [ ] srcSlidingWindow = source . slidingWindow ; final int srcWindowOffset = source . windowOffset ; final long srcNumCoupons = source . numCoupons ; assert ( srcSlidingWindow != null ) ; assert ( srcWindowOffset == 0 ) ; final long numPairs = srcNumCoupons - srcNumPairs ; // because the window offset is zero assert numPairs < Integer . MAX_VALUE ; final int numPairsFromArray = ( int ) numPairs ; assert ( numPairsFromArray + srcNumPairs ) == srcNumCoupons ; //for test final int [ ] allPairs = trickyGetPairsFromWindow ( srcSlidingWindow , srcK , numPairsFromArray , srcNumPairs ) ; PairTable . merge ( srcPairArr , 0 , srcNumPairs , allPairs , srcNumPairs , numPairsFromArray , allPairs , 0 ) ; // note the overlapping subarray trick //FOR TESTING If needed // for (int i = 0; i < (source.numCoupons - 1); i++) { // assert (Integer.compareUnsigned(allPairs[i], allPairs[i + 1]) < 0); } compressTheSurprisingValues ( target , source , allPairs , ( int ) srcNumCoupons ) ; }
of a Pinned sketch before compressing it . Hence the name Hybrid .