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

netflix.ocelli.loadbalancer.weighting.ClientsAndWeights Maven / Gradle / Ivy

There is a newer version: 0.1.0-rc.2
Show newest version
package netflix.ocelli.loadbalancer.weighting;

import java.util.List;


public class ClientsAndWeights {
    private final List clients;
    private final List weights;
    
    public ClientsAndWeights(List clients, List weights) {
        this.clients = clients;
        this.weights = weights;
    }

    public List getClients() {
        return clients;
    }

    public List getWeights() {
        return weights;
    }

    public boolean isEmpty() {
        return clients.isEmpty();
    }

    public int size() {
        return clients.size();
    }
    
    public int getTotalWeights() {
        if (weights == null || weights.size() == 0)
            return 0;
        return weights.get(weights.size() -1);
    }

    public C getClient(int index) {
        return clients.get(index);
    }
    
    public int getWeight(int index) {
        if (weights == null) 
            return 0;
        return weights.get(index);
    }
    
    @Override
    public String toString() {
        return "ClientsAndWeights [clients=" + clients + ", weights=" + weights
                + "]";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy