Source:
<code>private static final Sketch heapifyFromMemory(final Memory srcMem, final long seed) { final long cap = srcMem.getCapacity(); if (cap < 8) { throw new SketchesArgumentException( "Corrupted: valid sketch must be at least 8 bytes."); } final byte familyID = srcMem.getByte(FAMILY_BYTE); final Family family = idToFamily(familyID); final int preLongs = PreambleUtil.extractPreLongs(srcMem); final int flags = PreambleUtil.extractFlags(srcMem); final boolean orderedFlag = (flags & ORDERED_FLAG_MASK) != 0; final boolean compactFlag = (flags & COMPACT_FLAG_MASK) != 0; switch (family) { case ALPHA: { if (compactFlag) { throw new SketchesArgumentException( "Corrupted: ALPHA family image: cannot be compact"); } return HeapAlphaSketch.heapifyInstance(srcMem, seed); } case QUICKSELECT: { return HeapQuickSelectSketch.heapifyInstance(srcMem, seed); } case COMPACT: { if (!compactFlag) { throw new SketchesArgumentException( "Corrupted: COMPACT family sketch image must have compact flag set"); } final boolean readOnly = (flags & READ_ONLY_FLAG_MASK) != 0; if (!readOnly) { throw new SketchesArgumentException( "Corrupted: COMPACT family sketch image must have Read-Only flag set"); } final boolean empty = PreambleUtil.isEmpty(srcMem); <START> if (empty) { END> return EmptyCompactSketch.getInstance(srcMem); } checkMemorySeedHash(srcMem, seed); if (preLongs == 1) { if (isSingleItem(srcMem)) { return SingleItemSketch.heapify(srcMem, seed); } else { return EmptyCompactSketch.getInstance(srcMem); } } return orderedFlag ? HeapCompactOrderedSketch.heapifyInstance(srcMem, seed) : HeapCompactUnorderedSketch.heapifyInstance(srcMem, seed); } default: { throw new SketchesArgumentException( "Sketch cannot heapify family: " + family + " as a Sketch"); } } }</code><technical_language>clear do</technical_language>

Target:
private static final Sketch heapifyFromMemory(final Memory srcMem, final long seed) { final long cap = srcMem.getCapacity(); if (cap < 8) { throw new SketchesArgumentException( "Corrupted: valid sketch must be at least 8 bytes."); } final byte familyID = srcMem.getByte(FAMILY_BYTE); final Family family = idToFamily(familyID); final int preLongs = PreambleUtil.extractPreLongs(srcMem); final int flags = PreambleUtil.extractFlags(srcMem); final boolean orderedFlag = (flags & ORDERED_FLAG_MASK) != 0; final boolean compactFlag = (flags & COMPACT_FLAG_MASK) != 0; switch (family) { case ALPHA: { if (compactFlag) { throw new SketchesArgumentException( "Corrupted: ALPHA family image: cannot be compact"); } return HeapAlphaSketch.heapifyInstance(srcMem, seed); } case QUICKSELECT: { return HeapQuickSelectSketch.heapifyInstance(srcMem, seed); } case COMPACT: { if (!compactFlag) { throw new SketchesArgumentException( "Corrupted: COMPACT family sketch image must have compact flag set"); } final boolean readOnly = (flags & READ_ONLY_FLAG_MASK) != 0; if (!readOnly) { throw new SketchesArgumentException( "Corrupted: COMPACT family sketch image must have Read-Only flag set"); } if (PreambleUtil.isEmpty(srcMem)) { return EmptyCompactSketch.getInstance(srcMem); } if (preLongs == 1) { if (isSingleItem(srcMem)) { return SingleItemSketch.heapify(srcMem, seed); } else { return EmptyCompactSketch.getInstance(srcMem); } } return orderedFlag ? HeapCompactOrderedSketch.heapifyInstance(srcMem, seed) : HeapCompactUnorderedSketch.heapifyInstance(srcMem, seed); } default: { throw new SketchesArgumentException( "Sketch cannot heapify family: " + family + " as a Sketch"); } } }