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

org.mydotey.quantile.gk.GkQuantileEstimatorConfig Maven / Gradle / Ivy

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

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

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

    private Comparator _comparator;
    private double _error;
    private int _compactThreshold;

    public GkQuantileEstimatorConfig(Comparator comparator, double error, int compactThreshold) {
        Objects.requireNonNull(comparator, "comparator is null");

        String format = "%s %f invalid: expected number between 0.0 and 1.0.";
        if (error < 0.0 || error > 1.0)
            throw new IllegalArgumentException(String.format(format, "error", error));

        if (compactThreshold <= 0)
            throw new IllegalArgumentException("compactThreshold is less than 1");

        _comparator = comparator;
        _error = error;
        _compactThreshold = compactThreshold;
    }

    public Comparator getComparator() {
        return _comparator;
    }

    public double getError() {
        return _error;
    }

    public int getCompactThreshold() {
        return _compactThreshold;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy