private void processVer3 ( final Memory skMem ) { Util . checkSeedHashes ( seedHash_ , skMem . getShort ( SEED_HASH_SHORT ) ) ; final int preLongs = skMem . getByte ( PREAMBLE_LONGS_BYTE ) & 0X3F ; final int curCount ; final long thetaLongIn ; if ( preLongs == 1 ) { //SingleItemSketch if not empty, Read-Only, Compact and Ordered final int flags = skMem . getByte ( FLAGS_BYTE ) ; if ( flags == ( READ_ONLY_FLAG_MASK | COMPACT_FLAG_MASK | ORDERED_FLAG_MASK ) ) { curCount = 1 ; thetaLongIn = Long . MAX_VALUE ; } else { return ; //otherwise an empty sketch {1.0, 0, T} } } else if ( preLongs == 2 ) { //curCount has to be > 0 and exact mode. Cannot be from intersection. curCount = skMem . getInt ( RETAINED_ENTRIES_INT ) ; assert curCount > 0 ; thetaLongIn = Long . MAX_VALUE ; } else { //prelongs == 3, curCount may be 0 (e.g., from intersection). curCount = skMem . getInt ( RETAINED_ENTRIES_INT ) ; assert curCount > 0 ; thetaLongIn = skMem . getLong ( THETA_LONG ) ; } unionThetaLong_ = min ( unionThetaLong_ , thetaLongIn ) ; //theta rule final boolean ordered = ( skMem . getByte ( FLAGS_BYTE ) & ORDERED_FLAG_MASK ) != 0 ; if ( ordered ) { //must be compact for ( int i = 0 ; i < curCount ; i ++ ) { final int offsetBytes = ( preLongs + i ) << 3 ; final long hashIn = skMem . getLong ( offsetBytes ) ; if ( hashIn >= unionThetaLong_ ) { break ; } // "early stop" gadget_ . hashUpdate ( hashIn ) ; //backdoor update, hash function is bypassed } } else { //not-ordered, could be compact or hash-table form final boolean compact = ( skMem . getByte ( FLAGS_BYTE ) & COMPACT_FLAG_MASK ) != 0 ; final int size = ( compact ) ? curCount : 1 << skMem . getByte ( LG_ARR_LONGS_BYTE ) ; for ( int i = 0 ; i < size ; i ++ ) { final int offsetBytes = ( preLongs + i ) << 3 ; final long hashIn = skMem . getLong ( offsetBytes ) ; if ( ( hashIn <= 0L ) || ( hashIn >= unionThetaLong_ ) ) { continue ; } gadget_ . hashUpdate ( hashIn ) ; //backdoor update, hash function is bypassed } } unionThetaLong_ = min ( unionThetaLong_ , gadget_ . getThetaLong ( ) ) ; //sync thetaLongs unionEmpty_ = unionEmpty_ && gadget_ . isEmpty ( ) ; }
could be unordered ordered compact or not size > = 8