use of com.yahoo.sketches.SketchesArgumentException in project sketches-core by DataSketches.
the class SetOperation method heapify.
/**
* Heapify takes the SetOperation image in Memory and instantiates an on-heap
* SetOperation using the given seed.
* The resulting SetOperation will not retain any link to the source Memory.
* @param srcMem an image of a SetOperation where the hash of the given seed matches the image seed hash.
* <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
* @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a>.
* @return a Heap-based SetOperation from the given Memory
*/
public static SetOperation heapify(final Memory srcMem, final long seed) {
final byte famID = srcMem.getByte(FAMILY_BYTE);
final Family family = idToFamily(famID);
switch(family) {
case UNION:
{
return UnionImpl.heapifyInstance(srcMem, seed);
}
case INTERSECTION:
{
return IntersectionImpl.heapifyInstance(srcMem, seed);
}
default:
{
throw new SketchesArgumentException("SetOperation cannot heapify family: " + family.toString());
}
}
}
Aggregations