1 package civitas.result;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import org.springframework.stereotype.Controller;
7
8 @Controller
9 public class MakeCloudWordList {
10 public List<NameAndStrength> apply(final String[] candidates, final List<List<CandidateResult>> winnerList) {
11 List<NameAndStrength> cloudWords = new ArrayList<>();
12 for (List<CandidateResult> step : winnerList) {
13 for (CandidateResult result : step) {
14 String name = candidates[result.candidate];
15 Long strength = result.strength.longValue();
16 NameAndStrength e = new NameAndStrength(name, strength);
17 cloudWords.add(e);
18 }
19 }
20 return cloudWords;
21 }
22 }