Changeset 20 for protocol/src/main/java/geniusweb
- Timestamp:
- 08/05/20 09:42:15 (4 years ago)
- Location:
- protocol/src/main/java/geniusweb/protocol
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
protocol/src/main/java/geniusweb/protocol/session/SessionState.java
r11 r20 65 65 */ 66 66 Bid getAgreement(); 67 68 /** 69 * 70 * @return the {@link SessionResult}. Assumes {@link #isFinal(long)}. result 71 * may be undefined if not. 72 */ 73 SessionResult getResult(); 67 74 } -
protocol/src/main/java/geniusweb/protocol/session/saop/SAOPState.java
r10 r20 19 19 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 20 20 import geniusweb.protocol.session.DefaultSessionState; 21 import geniusweb.protocol.session.SessionResult; 21 22 import geniusweb.protocol.session.SessionSettings; 22 23 import geniusweb.references.PartyWithProfile; … … 248 249 } 249 250 251 @Override 252 public SessionResult getResult() { 253 List<Double> emptylist = new LinkedList<>(); 254 for (int n = 0; n < getConnections().size(); n++) 255 emptylist.add(0d); 256 return new SessionResult(getSettings().getAllParties(), getAgreement(), 257 emptylist, getError()); 258 } 259 250 260 } -
protocol/src/main/java/geniusweb/protocol/session/shaop/BareSHAOPState.java
r18 r20 1 1 package geniusweb.protocol.session.shaop; 2 2 3 import java.util.Arrays; 3 4 import java.util.Collections; 4 5 import java.util.LinkedList; … … 13 14 import geniusweb.protocol.ProtocolException; 14 15 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 16 import geniusweb.protocol.session.SessionResult; 15 17 import geniusweb.protocol.session.SessionSettings; 16 18 import geniusweb.protocol.session.SessionState; … … 169 171 170 172 @Override 173 public SessionResult getResult() { 174 Double[] penalties = new Double[partyNumbers.size()]; 175 for (PartyId party : partyNumbers.keySet()) { 176 Double spent = totalSpent.get(party); 177 if (spent == null) { 178 spent = 0d; 179 } else { 180 spent = Math.max(0, Math.min(1.0, spent)); 181 } 182 penalties[partyNumbers.get(party)] = spent; 183 } 184 return new SessionResult(getSettings().getAllParties(), getAgreement(), 185 Arrays.asList(penalties), getError()); 186 187 } 188 189 @Override 171 190 public int hashCode() { 172 191 final int prime = 31; -
protocol/src/main/java/geniusweb/protocol/tournament/allpermutations/AllPermutationsProtocol.java
r10 r20 6 6 import geniusweb.events.TournamentStarted; 7 7 import geniusweb.protocol.CurrentNegoState; 8 import geniusweb.protocol.SessionResult;9 8 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 10 9 import geniusweb.protocol.session.SessionProtocol; 10 import geniusweb.protocol.session.SessionResult; 11 11 import geniusweb.protocol.session.SessionSettings; 12 12 import geniusweb.protocol.session.SessionState; … … 83 83 // List<TeamOfPartiesAndProfiles> participants = 84 84 // sessionstate.getSettings().getParticipants() 85 SessionResult result = new SessionResult( 86 sessionstate.getSettings().getAllParties(), 87 sessionstate.getAgreement(), sessionstate.getError()); 85 SessionResult result = sessionstate.getResult(); 88 86 state = state.with(result); 89 87 notifyListeners(new CurrentNegoState(state)); -
protocol/src/main/java/geniusweb/protocol/tournament/allpermutations/AllPermutationsState.java
r10 r20 6 6 7 7 import geniusweb.protocol.ProtocolException; 8 import geniusweb.protocol. SessionResult;8 import geniusweb.protocol.session.SessionResult; 9 9 import geniusweb.protocol.session.SessionSettings; 10 10 import geniusweb.protocol.tournament.TournamentState;
Note:
See TracChangeset
for help on using the changeset viewer.