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

org.kaizen4j.common.algorithm.hash.WeightedShard Maven / Gradle / Ivy

package org.kaizen4j.common.algorithm.hash;

import com.google.common.base.Preconditions;

public class WeightedShard {

    private T t;

    private int weight;

    public WeightedShard(T t, int weight) {
        this.t = t;
        this.weight = weight;
        checkArguments();
    }

    private void checkArguments() {
        Preconditions.checkArgument(weight > 0, "The argument 'weight' must be great than zero");
        Preconditions.checkNotNull(t);
    }

    public T getServer() {
        return t;
    }

    public int getWeight() {
        return weight;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy