blob: 0378b86e128673d119db2b8c37b019eb3179e798 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// 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<HostSpec> hosts;
private AllocatedHosts(Set<HostSpec> hosts) {
this.hosts = new LinkedHashSet<>(hosts); // Preserve order for tests
}
public static AllocatedHosts withHosts(Set<HostSpec> hosts) {
return new AllocatedHosts(hosts);
}
/** Returns the hosts of this allocation */
public Set<HostSpec> 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();
}
}
|