static DirectCompactDoublesSketch wrapInstance ( final Memory srcMem ) { final long memCap = srcMem . getCapacity ( ) ; final int preLongs = extractPreLongs ( srcMem ) ; final int serVer = extractSerVer ( srcMem ) ; final int familyID = extractFamilyID ( srcMem ) ; final int flags = extractFlags ( srcMem ) ; final int k = extractK ( srcMem ) ; final boolean empty = ( flags & EMPTY_FLAG_MASK ) > 0 ; final long n = empty ? 0 : extractN ( srcMem ) ; //VALIDITY CHECKS DirectUpdateDoublesSketchR . checkPreLongs ( preLongs ) ; Util . checkFamilyID ( familyID ) ; DoublesUtil . checkDoublesSerVer ( serVer , MIN_DIRECT_DOUBLES_SER_VER ) ; checkCompact ( serVer , flags ) ; Util . checkK ( k ) ; checkDirectMemCapacity ( k , n , memCap ) ; DirectUpdateDoublesSketchR . checkEmptyAndN ( empty , n ) ; final DirectCompactDoublesSketch dds = new DirectCompactDoublesSketch ( k ) ; dds . mem_ = ( WritableMemory ) srcMem ; return dds ; }
Wrap this sketch around the given compact Memory image of a DoublesSketch .