Class CompactSketch<S extends Summary>

  • Type Parameters:
    S - type of Summary

    public final class CompactSketch<S extends Summary>
    extends Sketch<S>
    CompactSketches are never created directly. They are created as a result of the compact() method of an UpdatableSketch or as a result of the getResult() method of a set operation like Union, Intersection or AnotB. CompactSketch consists of a compact list (i.e. no intervening spaces) of hash values, corresponding list of Summaries, and a value for theta. The lists may or may not be ordered. CompactSketch is read-only.
    • Method Detail

      • compact

        public CompactSketch<S> compact()
        Description copied from class: Sketch
        Converts this sketch to a CompactSketch on the Java heap.

        If this sketch is already in compact form this operation returns this.

        Specified by:
        compact in class Sketch<S extends Summary>
        Returns:
        this sketch as a CompactSketch on the Java heap.
      • getRetainedEntries

        public int getRetainedEntries()
        Specified by:
        getRetainedEntries in class Sketch<S extends Summary>
        Returns:
        number of retained entries
      • getCountLessThanThetaLong

        public int getCountLessThanThetaLong​(long thetaLong)
        Description copied from class: Sketch
        Gets the number of hash values less than the given theta expressed as a long.
        Specified by:
        getCountLessThanThetaLong in class Sketch<S extends Summary>
        Parameters:
        thetaLong - the given theta as a long between zero and Long.MAX_VALUE.
        Returns:
        the number of hash values less than the given thetaLong.
      • toByteArray

        public byte[] toByteArray()
        Description copied from class: Sketch
        This is to serialize a sketch instance to a byte array.

        As of 3.0.0, serializing an UpdatableSketch is deprecated. This capability will be removed in a future release. Serializing a CompactSketch is not deprecated.

        Specified by:
        toByteArray in class Sketch<S extends Summary>
        Returns:
        serialized representation of the sketch