All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mydotey.quantile.kll.KllQuantileEstimatorConfig Maven / Gradle / Ivy

The newest version!
package org.mydotey.quantile.kll;

import java.util.Comparator;
import java.util.Objects;

/**
 * @author koqizhao
 *
 * Apr 1, 2018
 */
public class KllQuantileEstimatorConfig {

    private Comparator _comparator;
    private int _k;
    private double _c;

    /**
     * @param k    first compactor size
     * c default to 2.0 / 3.0
     */
    public KllQuantileEstimatorConfig(Comparator comparator, int k) {
        this(comparator, k, 2.0 / 3.0);
    }

    /**
     * @param k    first compactor size
     * @param c    compaction rate
     */
    public KllQuantileEstimatorConfig(Comparator comparator, int k, double c) {
        Objects.requireNonNull(comparator, "comparator is null");

        if (k <= 0)
            throw new IllegalArgumentException("k must be a positive integer.");

        if (c <= 0.5 || c > 1.0)
            throw new IllegalArgumentException("c must be larger than 0.5 and at most 1.0.");

        _comparator = comparator;
        _k = k;
        _c = c;
    }

    public Comparator getComparator() {
        return _comparator;
    }

    public double getK() {
        return _k;
    }

    public double getC() {
        return _c;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy