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

com.yahoo.config.provision.AllocatedHosts Maven / Gradle / Ivy

There is a newer version: 8.441.21
Show newest version
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision;

import java.util.LinkedHashSet;
import java.util.Set;

/**
 * The hosts allocated to an application.
 *
 * @author Ulf Lilleengen
 * @author bratseth
 */
public class AllocatedHosts {

    private final Set hosts;

    private AllocatedHosts(Set hosts) {
        this.hosts = new LinkedHashSet<>(hosts); // Preserve order for tests
    }

    public static AllocatedHosts withHosts(Set hosts) {
        return new AllocatedHosts(hosts);
    }

    /** Returns the hosts of this allocation */
    public Set getHosts() { return hosts; }
    
    @Override
    public boolean equals(Object other) {
        if (other == this) return true;
        if ( ! (other instanceof AllocatedHosts)) return false;
        return ((AllocatedHosts) other).hosts.equals(this.hosts);
    }
    
    @Override
    public int hashCode() {
        return hosts.hashCode();
    }

    @Override
    public String toString() {
        return hosts.toString();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy