source: protocol/src/main/java/geniusweb/protocol/tournament/allpermutationslearn/AllPermutationsLearnState.java@ 40

Last change on this file since 40 was 40, checked in by bart, 3 years ago

LEARN algorithm now also available. Fixed small issues.

File size: 1.2 KB
Line 
1package geniusweb.protocol.tournament.allpermutationslearn;
2
3import java.util.ArrayList;
4import java.util.List;
5
6import geniusweb.protocol.session.SessionResult;
7import geniusweb.protocol.session.SessionSettings;
8import geniusweb.protocol.tournament.allpermutations.AllPermutationsState;
9import tudelft.utilities.immutablelist.ImmutableList;
10
11/**
12 * A non-parallel simple implementation of all-permutations
13 */
14public class AllPermutationsLearnState extends AllPermutationsState {
15
16 public AllPermutationsLearnState(AllPermutationsLearnSettings toursettings,
17 ImmutableList<SessionSettings> settings,
18 List<SessionResult> results) {
19 super(toursettings, settings, results);
20 }
21
22 /**
23 *
24 * @param result the next {@link SessionResult}
25 * @return new state
26 * @throws IllegalArgumentException if the result participants are not
27 * matching the expected participants
28 */
29 @Override
30 public AllPermutationsLearnState with(SessionResult result) {
31 ArrayList<SessionResult> newresults = new ArrayList<>(results);
32 newresults.add(result);
33 return new AllPermutationsLearnState(
34 (AllPermutationsLearnSettings) toursettings, sessionsettings,
35 newresults);
36 }
37
38}
Note: See TracBrowser for help on using the repository browser.