static IntersectionImplR heapifyInstance ( final Memory srcMem , final long seed ) { final IntersectionImpl impl = new IntersectionImpl ( null , seed , false ) ; //Get Preamble //Note: Intersection does not use lgNomLongs (or k), per se. //seedHash loaded and checked in private constructor final int preLongsMem = srcMem . getByte ( PREAMBLE_LONGS_BYTE ) & 0X3F ; final int serVer = srcMem . getByte ( SER_VER_BYTE ) & 0XFF ; final int famID = srcMem . getByte ( FAMILY_BYTE ) & 0XFF ; final int lgArrLongs = srcMem . getByte ( LG_ARR_LONGS_BYTE ) & 0XFF ; final int flags = srcMem . getByte ( FLAGS_BYTE ) & 0XFF ; final int curCount = srcMem . getInt ( RETAINED_ENTRIES_INT ) ; final long thetaLong = srcMem . getLong ( THETA_LONG ) ; final boolean empty = ( flags & EMPTY_FLAG_MASK ) > 0 ; //Checks if ( preLongsMem != CONST_PREAMBLE_LONGS ) { throw new SketchesArgumentException ( "Memory PreambleLongs must equal " + CONST_PREAMBLE_LONGS + ": " + preLongsMem ) ; } if ( serVer != SER_VER ) { throw new SketchesArgumentException ( "Serialization Version must equal " + SER_VER ) ; } Family . INTERSECTION . checkFamilyID ( famID ) ; if ( empty ) { if ( curCount != 0 ) { throw new SketchesArgumentException ( "srcMem empty state inconsistent with curCount: " + empty + "," + curCount ) ; } //empty = true AND curCount_ = 0: OK } //Initialize impl . lgArrLongs_ = lgArrLongs ; impl . curCount_ = curCount ; impl . thetaLong_ = thetaLong ; impl . empty_ = empty ; if ( ! empty ) { if ( curCount > 0 ) { //can't be virgin, empty, or curCount == 0 impl . hashTable_ = new long [ 1 << lgArrLongs ] ; srcMem . getLongArray ( CONST_PREAMBLE_LONGS << 3 , impl . hashTable_ , 0 , 1 << lgArrLongs ) ; } } return impl ; }
Heapify an intersection target from a Memory image containing data .