- Timestamp:
- 01/28/20 10:19:54 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocol/src/main/java/geniusweb/protocol/session/saop/SAOPSettings.java
r1 r10 4 4 import java.util.LinkedList; 5 5 import java.util.List; 6 import java.util.stream.Collectors; 6 7 7 8 import com.fasterxml.jackson.annotation.JsonCreator; … … 11 12 import geniusweb.protocol.session.SessionProtocol; 12 13 import geniusweb.protocol.session.SessionSettings; 14 import geniusweb.protocol.session.TeamOfPartiesAndProfiles; 13 15 import geniusweb.references.PartyWithProfile; 14 16 import tudelft.utilities.logging.Reporter; 15 17 16 18 public class SAOPSettings implements SessionSettings { 17 private final List< PartyWithProfile> participants;19 private final List<SaopPartyWithProfile> participants; 18 20 private final Deadline deadline; 19 21 … … 28 30 @JsonCreator 29 31 public SAOPSettings( 30 @JsonProperty("participants") List< PartyWithProfile> participants,32 @JsonProperty("participants") List<SaopPartyWithProfile> participants, 31 33 @JsonProperty("deadline") Deadline deadline) { 32 34 this.participants = participants; … … 51 53 52 54 @Override 53 public List< PartyWithProfile> getParticipants() {55 public List<TeamOfPartiesAndProfiles> getTeams() { 54 56 return Collections.unmodifiableList(participants); 55 57 } … … 60 62 public Deadline getDeadline() { 61 63 return deadline; 64 } 65 66 @Override 67 public List<PartyWithProfile> getAllParties() { 68 return participants.stream() 69 .map(particip -> particip.getAllParties().get(0)) 70 .collect(Collectors.toList()); 62 71 } 63 72 … … 101 110 102 111 @Override 103 public SessionSettings with(PartyWithProfile party) { 104 List<PartyWithProfile> newparts = new LinkedList<>(participants); 105 newparts.add(party); 112 public SessionSettings with(TeamOfPartiesAndProfiles party) { 113 if (!(party instanceof SaopPartyWithProfile)) 114 throw new IllegalArgumentException( 115 "Added party must be SaopPartyWithProfile but got " 116 + party); 117 List<SaopPartyWithProfile> newparts = new LinkedList<>(participants); 118 newparts.add((SaopPartyWithProfile) party); 106 119 return new SAOPSettings(newparts, deadline); 107 120 }
Note:
See TracChangeset
for help on using the changeset viewer.