code: private static final Sketch constructHeapSketch(final byte famID, final boolean ordered,
        final Memory srcMem, final long seed) {
      final boolean compact = (srcMem.getByte(FLAGS_BYTE) & COMPACT_FLAG_MASK) != 0;
      final Family family = idToFamily(famID);
      switch (family) {
        case ALPHA: {
          if (compact) {
            throw new SketchesArgumentException("Possibly Corrupted " + family
                + " image: cannot be compact");
          }
          return HeapAlphaSketch.heapifyInstance(srcMem, seed);
        }
        case QUICKSELECT: {
          return HeapQuickSelectSketch.heapifyInstance(srcMem, seed);
        }
        case COMPACT: {
          if (!compact) {
            throw new SketchesArgumentException("Possibly Corrupted " + family
                + " image: must be compact");
          }
          return ordered ? HeapCompactOrderedSketch.heapifyInstance(srcMem, seed)
                         : HeapCompactUnorderedSketch.heapifyInstance(srcMem, seed);
        }
        default: {
          throw new SketchesArgumentException("Sketch cannot heapify family: " + family
              + " as a Sketch");
        }
      }
    }
docs: Instantiates a Heap Sketch from Memory.
  @param famID the Family ID
  @param ordered true if the sketch is of the Compact family and ordered
  @param srcMem <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
  @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a>.
  The seed required to instantiate a non-compact sketch.
  @return a Sketch