-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCandidate.java
More file actions
46 lines (36 loc) · 984 Bytes
/
Copy pathCandidate.java
File metadata and controls
46 lines (36 loc) · 984 Bytes
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
46
package safe.immutable;
import com.sun.xml.internal.stream.util.ReadOnlyIterator;
import synchrone.Endpoint;
import java.util.Iterator;
import java.util.Set;
import java.util.Spliterator;
import java.util.function.Consumer;
/**
* @author Kyle
* @create 2018/5/29 23:34
*/
public class Candidate implements Iterable<Endpoint> {
// 下游部件节点列表
private final Set<Endpoint> endpoints;
// 下游部件节点的总权重
public final int totalWeight;
public Candidate(Set<Endpoint> endpoints) {
int sum = 0;
for(Endpoint endpoint : endpoints) {
sum += endpoint.weight;
}
this.totalWeight = sum;
this.endpoints = endpoints;
}
@Override
public final Iterator<Endpoint> iterator() {
return null;
}
@Override
public void forEach(Consumer<? super Endpoint> action) {
}
@Override
public Spliterator<Endpoint> spliterator() {
return null;
}
}