Changeset 9
- Timestamp:
- 11/28/19 14:40:48 (5 years ago)
- Files:
-
- 34 added
- 55 edited
Legend:
- Unmodified
- Added
- Removed
-
bidspace/pom.xml
r6 r9 6 6 <groupId>geniusweb</groupId> 7 7 <artifactId>bidspace</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 15 15 <basedir>.</basedir> 16 16 <passwd>${env.ARTIFACTORY_PASS}</passwd> 17 <jackson-2-version>2.9. 6</jackson-2-version>17 <jackson-2-version>2.9.10</jackson-2-version> 18 18 </properties> 19 19 … … 36 36 <groupId>geniusweb</groupId> 37 37 <artifactId>profile</artifactId> 38 <version>1. 0.0</version>38 <version>1.1.0</version> 39 39 </dependency> 40 40 -
events/pom.xml
r6 r9 6 6 <groupId>geniusweb</groupId> 7 7 <artifactId>events</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 43 43 <groupId>geniusweb</groupId> 44 44 <artifactId>issuevalue</artifactId> 45 <version>1. 0.0</version>45 <version>1.1.0</version> 46 46 </dependency> 47 47 <dependency> 48 48 <groupId>geniusweb</groupId> 49 49 <artifactId>references</artifactId> 50 <version>1. 0.0</version>50 <version>1.1.0</version> 51 51 </dependency> 52 52 -
exampleparties/boulware/pom.xml
r6 r9 6 6 <groupId>geniusweb.exampleparties</groupId> 7 7 <artifactId>boulware</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 33 33 <groupId>geniusweb.exampleparties</groupId> 34 34 <artifactId>timedependentparty</artifactId> 35 <version>1. 0.0</version>35 <version>1.1.0</version> 36 36 </dependency> 37 37 <dependency> -
exampleparties/conceder/pom.xml
r6 r9 6 6 <groupId>geniusweb.exampleparties</groupId> 7 7 <artifactId>conceder</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 33 33 <groupId>geniusweb.exampleparties</groupId> 34 34 <artifactId>timedependentparty</artifactId> 35 <version>1. 0.0</version>35 <version>1.1.0</version> 36 36 </dependency> 37 37 <dependency> -
exampleparties/hardliner/pom.xml
r6 r9 6 6 <groupId>geniusweb.exampleparties</groupId> 7 7 <artifactId>hardliner</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 33 33 <groupId>geniusweb.exampleparties</groupId> 34 34 <artifactId>timedependentparty</artifactId> 35 <version>1. 0.0</version>35 <version>1.1.0</version> 36 36 </dependency> 37 37 <dependency> -
exampleparties/linear/pom.xml
r4 r9 6 6 <groupId>geniusweb.exampleparties</groupId> 7 7 <artifactId>linear</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 33 33 <groupId>geniusweb.exampleparties</groupId> 34 34 <artifactId>timedependentparty</artifactId> 35 <version>1. 0.0</version>35 <version>1.1.0</version> 36 36 </dependency> 37 37 <dependency> -
exampleparties/randomparty/pom.xml
r6 r9 6 6 <groupId>geniusweb.exampleparties</groupId> 7 7 <artifactId>randomparty</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 33 33 <groupId>geniusweb</groupId> 34 34 <artifactId>party</artifactId> 35 <version>1. 0.0</version>35 <version>1.1.0</version> 36 36 </dependency> 37 37 … … 39 39 <groupId>geniusweb</groupId> 40 40 <artifactId>bidspace</artifactId> 41 <version>1.0.0</version> 41 <version>1.1.0</version> 42 </dependency> 43 <dependency> 44 <groupId>geniusweb</groupId> 45 <artifactId>profileconnection</artifactId> 46 <version>1.1.0</version> 42 47 </dependency> 43 48 <dependency> 44 49 <groupId>tudelft.utilities</groupId> 45 50 <artifactId>logging</artifactId> 46 <version>1.0.0</version>47 </dependency>48 <dependency>49 <groupId>geniusweb</groupId>50 <artifactId>profileconnection</artifactId>51 51 <version>1.0.0</version> 52 52 </dependency> -
exampleparties/randomparty/src/main/java/geniusweb/exampleparties/randomparty/RandomParty.java
r2 r9 25 25 import geniusweb.profile.PartialOrdering; 26 26 import geniusweb.profile.Profile; 27 import geniusweb.profile.utilityspace. LinearAdditiveUtilitySpace;27 import geniusweb.profile.utilityspace.UtilitySpace; 28 28 import geniusweb.profileconnection.ProfileConnectionFactory; 29 29 import geniusweb.profileconnection.ProfileInterface; … … 57 57 if (info instanceof Settings) { 58 58 Settings settings = (Settings) info; 59 this.profileint = ProfileConnectionFactory.create(settings.getProfile().getURI(), getReporter()); 59 this.profileint = ProfileConnectionFactory 60 .create(settings.getProfile().getURI(), getReporter()); 60 61 this.me = settings.getID(); 61 62 this.progress = settings.getProgress(); … … 74 75 } 75 76 } catch (Exception e) { 76 getReporter().log(Level.SEVERE,"Failed to handle info", e);77 throw new RuntimeException("Failed to handle info", e); 77 78 } 78 79 } … … 81 82 public Capabilities getCapabilities() { 82 83 try { 83 return new Capabilities(new HashSet<>(Arrays.asList(new ProtocolRef(new URI("SAOP"))))); 84 return new Capabilities(new HashSet<>( 85 Arrays.asList(new ProtocolRef(new URI("SAOP"))))); 84 86 } catch (URISyntaxException e) { 85 getReporter().log(Level.SEVERE, "Failed to create capabilities URI", e); 87 getReporter().log(Level.SEVERE, "Failed to create capabilities URI", 88 e); 86 89 return null; 87 90 } … … 99 102 } else { 100 103 // for demo. Obviously full bids have higher util in general 101 AllPartialBidsList bidspace = new AllPartialBidsList(profileint.getProfile().getDomain()); 104 AllPartialBidsList bidspace = new AllPartialBidsList( 105 profileint.getProfile().getDomain()); 102 106 Bid bid = null; 103 107 for (int attempt = 0; attempt < 20 && !isGood(bid); attempt++) { … … 115 119 return false; 116 120 Profile profile = profileint.getProfile(); 117 if (profile instanceof LinearAdditiveUtilitySpace) {118 return (( LinearAdditiveUtilitySpace) profile).getUtility(bid).doubleValue() > 0.6;121 if (profile instanceof UtilitySpace) { 122 return ((UtilitySpace) profile).getUtility(bid).doubleValue() > 0.6; 119 123 } 120 124 if (profile instanceof PartialOrdering) { 121 return ((PartialOrdering) profile).isPreferredOrEqual(bid, profile.getReservationBid()); 125 return ((PartialOrdering) profile).isPreferredOrEqual(bid, 126 profile.getReservationBid()); 122 127 } 123 throw new IllegalArgumentException("Can not handle profile type " + profile.getClass()); 128 throw new IllegalArgumentException( 129 "Can not handle profile type " + profile.getClass()); 124 130 } 125 131 -
exampleparties/randomparty/src/test/java/geniusweb/exampleparties/randomparty/RandomPartyTest.java
r8 r9 33 33 import geniusweb.actions.PartyId; 34 34 import geniusweb.bidspace.AllBidsList; 35 import geniusweb.connection.Connection ;35 import geniusweb.connection.ConnectionEnd; 36 36 import geniusweb.issuevalue.Bid; 37 37 import geniusweb.party.Capabilities; … … 107 107 public void testInformSettings() { 108 108 party.connect(connection); 109 connection.notify Change(settings);109 connection.notifyListeners(settings); 110 110 assertEquals(0, connection.getActions().size()); 111 111 } … … 199 199 */ 200 200 class TestConnection extends DefaultListenable<Inform> 201 implements Connection <Inform, Action> {201 implements ConnectionEnd<Inform, Action> { 202 202 private List<Action> actions = new LinkedList<>(); 203 203 -
exampleparties/randompartypy/pom.xml
r6 r9 6 6 <groupId>geniusweb.exampleparties</groupId> 7 7 <artifactId>randompyparty</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 31 31 <groupId>geniusweb</groupId> 32 32 <artifactId>pythonadapter</artifactId> 33 <version>1. 0.0</version>33 <version>1.1.0</version> 34 34 </dependency> 35 35 … … 37 37 <groupId>geniusweb</groupId> 38 38 <artifactId>bidspace</artifactId> 39 <version>1. 0.0</version>39 <version>1.1.0</version> 40 40 </dependency> 41 41 <dependency> 42 42 <groupId>geniusweb</groupId> 43 43 <artifactId>profileconnection</artifactId> 44 <version>1. 0.0</version>44 <version>1.1.0</version> 45 45 </dependency> 46 46 <dependency> -
exampleparties/randompartypy/src/main/resources/RandomParty.py
r2 r9 24 24 import geniusweb.profile.Profile as Profile 25 25 import geniusweb.profile.PartialOrdering as PartialOrdering 26 import geniusweb.profile.utilityspace. LinearAdditiveUtilitySpace as LinearAdditiveUtilitySpace26 import geniusweb.profile.utilityspace.UtilitySpace as UtilitySpace 27 27 import geniusweb.references.ProfileRef as ProfileRef 28 28 import geniusweb.references.ProtocolRef as ProtocolRef … … 97 97 return false 98 98 profile = self.profile.getProfile() 99 if isinstance(profile, LinearAdditiveUtilitySpace):99 if isinstance(profile, UtilitySpace): 100 100 return profile.getUtility(bid).doubleValue() > 0.6; 101 101 if isinstance(profile, PartialOrdering): -
exampleparties/randompartypy/src/test/java/geniusweb/exampleparties/randompartypy/RandomPartyTest.java
r8 r9 31 31 import geniusweb.actions.PartyId; 32 32 import geniusweb.bidspace.AllBidsList; 33 import geniusweb.connection.Connection ;33 import geniusweb.connection.ConnectionEnd; 34 34 import geniusweb.issuevalue.Bid; 35 35 import geniusweb.party.Capabilities; … … 111 111 public void testInformSettings() { 112 112 party.connect(connection); 113 connection.notify Change(settings);113 connection.notifyListeners(settings); 114 114 assertEquals(0, connection.getActions().size()); 115 115 } … … 190 190 */ 191 191 class TestConnection extends DefaultListenable<Inform> 192 implements Connection <Inform, Action> {192 implements ConnectionEnd<Inform, Action> { 193 193 private List<Action> actions = new LinkedList<>(); 194 194 -
exampleparties/timedependentparty/pom.xml
r8 r9 6 6 <groupId>geniusweb.exampleparties</groupId> 7 7 <artifactId>timedependentparty</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 33 33 <groupId>geniusweb</groupId> 34 34 <artifactId>party</artifactId> 35 <version>1. 0.0</version>35 <version>1.1.0</version> 36 36 </dependency> 37 37 … … 39 39 <groupId>geniusweb</groupId> 40 40 <artifactId>bidspace</artifactId> 41 <version>1.0.0</version> 41 <version>1.1.0</version> 42 </dependency> 43 <dependency> 44 <groupId>geniusweb</groupId> 45 <artifactId>profileconnection</artifactId> 46 <version>1.1.0</version> 42 47 </dependency> 43 48 <dependency> 44 49 <groupId>tudelft.utilities</groupId> 45 50 <artifactId>logging</artifactId> 46 <version>1.0.0</version>47 </dependency>48 <dependency>49 <groupId>geniusweb</groupId>50 <artifactId>profileconnection</artifactId>51 51 <version>1.0.0</version> 52 52 </dependency> -
exampleparties/timedependentparty/src/test/java/geniusweb/exampleparties/timedependentparty/TimeDependentPartyTest.java
r8 r9 33 33 import geniusweb.actions.PartyId; 34 34 import geniusweb.bidspace.AllBidsList; 35 import geniusweb.connection.Connection ;35 import geniusweb.connection.ConnectionEnd; 36 36 import geniusweb.issuevalue.Bid; 37 37 import geniusweb.party.Capabilities; … … 118 118 public void testInformSettings() { 119 119 party.connect(connection); 120 connection.notify Change(settings);120 connection.notifyListeners(settings); 121 121 assertEquals(0, connection.getActions().size()); 122 122 } … … 223 223 */ 224 224 class TestConnection extends DefaultListenable<Inform> 225 implements Connection <Inform, Action> {225 implements ConnectionEnd<Inform, Action> { 226 226 private List<Action> actions = new LinkedList<>(); 227 227 -
issuevalue/pom.xml
r6 r9 6 6 <groupId>geniusweb</groupId> 7 7 <artifactId>issuevalue</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 -
issuevalue/src/main/java/geniusweb/issuevalue/Bid.java
r4 r9 98 98 } 99 99 100 /** 101 * 102 * @return (unmodifyable) map with all issues and values in the bid. 103 */ 104 public Map<String, Value> getIssueValues() { 105 return Collections.unmodifiableMap(issuevalues); 106 } 107 100 108 @Override 101 109 public String toString() { -
party/pom.xml
r6 r9 6 6 <groupId>geniusweb</groupId> 7 7 <artifactId>party</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 31 31 <groupId>geniusweb</groupId> 32 32 <artifactId>timeline</artifactId> 33 <version>1. 0.0</version>33 <version>1.1.0</version> 34 34 </dependency> 35 35 <dependency> 36 36 <groupId>geniusweb</groupId> 37 37 <artifactId>profile</artifactId> 38 <version>1. 0.0</version>38 <version>1.1.0</version> 39 39 </dependency> 40 40 <dependency> 41 41 <groupId>geniusweb</groupId> 42 42 <artifactId>events</artifactId> 43 <version>1.0.0</version> 43 <version>1.1.0</version> 44 </dependency> 45 <dependency> 46 <groupId>geniusweb</groupId> 47 <artifactId>references</artifactId> 48 <version>1.1.0</version> 44 49 </dependency> 45 50 <dependency> 46 51 <groupId>tudelft.utilities</groupId> 47 52 <artifactId>listener</artifactId> 48 <version>1.0.0</version> 49 </dependency> 50 <dependency> 51 <groupId>geniusweb</groupId> 52 <artifactId>references</artifactId> 53 <version>1.0.0</version> 53 <version>1.1.0</version> 54 54 </dependency> 55 55 <dependency> -
party/src/main/java/geniusweb/party/DefaultParty.java
r1 r9 2 2 3 3 import geniusweb.actions.Action; 4 import geniusweb.connection.Connection ;4 import geniusweb.connection.ConnectionEnd; 5 5 import geniusweb.party.inform.Inform; 6 6 import tudelft.utilities.listener.Listener; … … 13 13 */ 14 14 public abstract class DefaultParty implements Party, Listener<Inform> { 15 private Connection <Inform, Action> connection = null;15 private ConnectionEnd<Inform, Action> connection = null; 16 16 protected Reporter reporter; 17 17 … … 25 25 26 26 @Override 27 public void connect(Connection <Inform, Action> connection) {27 public void connect(ConnectionEnd<Inform, Action> connection) { 28 28 this.connection = connection; 29 29 connection.addListener(this); … … 47 47 * connected. 48 48 */ 49 public Connection <Inform, Action> getConnection() {49 public ConnectionEnd<Inform, Action> getConnection() { 50 50 return connection; 51 51 } -
pom.xml
r8 r9 13 13 <properties> 14 14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 15 <jackson-2-version>2.9. 6</jackson-2-version>15 <jackson-2-version>2.9.10</jackson-2-version> 16 16 </properties> 17 17 -
profile/pom.xml
r4 r9 6 6 <groupId>geniusweb</groupId> 7 7 <artifactId>profile</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 31 31 <groupId>geniusweb</groupId> 32 32 <artifactId>issuevalue</artifactId> 33 <version>1. 0.0</version>33 <version>1.1.0</version> 34 34 </dependency> 35 35 <dependency> 36 36 <groupId>geniusweb</groupId> 37 37 <artifactId>references</artifactId> 38 <version>1. 0.0</version>38 <version>1.1.0</version> 39 39 </dependency> 40 40 -
profile/src/main/java/geniusweb/profile/Profile.java
r2 r9 7 7 import geniusweb.issuevalue.Domain; 8 8 import geniusweb.profile.utilityspace.LinearAdditiveUtilitySpace; 9 import geniusweb.profile.utilityspace.SumOfGroupsUtilitySpace; 9 10 10 11 /** … … 17 18 @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT) 18 19 @JsonSubTypes({ @JsonSubTypes.Type(value = LinearAdditiveUtilitySpace.class), 19 @JsonSubTypes.Type(value = DefaultPartialOrdering.class) }) 20 @JsonSubTypes.Type(value = DefaultPartialOrdering.class), 21 @JsonSubTypes.Type(value = SumOfGroupsUtilitySpace.class) }) 20 22 public interface Profile { 21 23 … … 33 35 /** 34 36 * 35 * @return a (hypothetical) bid that is the best alternative to a non-agreement. 36 * Only bids that are {@link #isPreferredOrEqual(Bid, Bid)} should be 37 * accepted. If a negotiation does not reach an agreement, the party can 38 * get this offer somewhere else. This replaces the older notion of a 37 * @return a (hypothetical) bid that is the best alternative to a 38 * non-agreement. Only bids that are 39 * {@link #isPreferredOrEqual(Bid, Bid)} should be accepted. If a 40 * negotiation does not reach an agreement, the party can get this 41 * offer somewhere else. This replaces the older notion of a 39 42 * "reservation value" and is more general. If null, there is no 40 43 * reservation bid and any agreement is better than no agreement. -
profile/src/main/java/geniusweb/profile/utilityspace/DiscreteValueSetUtilities.java
r1 r9 8 8 import com.fasterxml.jackson.annotation.JsonAutoDetect; 9 9 import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; 10 import com.fasterxml.jackson.annotation.JsonTypeName; 10 11 11 12 import geniusweb.issuevalue.DiscreteValue; … … 13 14 import geniusweb.issuevalue.Value; 14 15 import geniusweb.issuevalue.ValueSet; 15 16 import com.fasterxml.jackson.annotation.JsonTypeName;17 16 18 17 /** … … 37 36 * create new object based on the given mapping from values to utilities. 38 37 * 39 * @param valueUtils map with key {@link DiscreteValue}s and value a Double in40 * the range [0,1].38 * @param valueUtils map with key {@link DiscreteValue}s and value a Double 39 * in the range [0,1]. 41 40 * @throws NullPointerException if one of the args is null 42 41 * @throws IllegalArgumentException if values are not in range [0,1]. 43 42 */ 44 public DiscreteValueSetUtilities(Map<DiscreteValue, BigDecimal> valueUtils) { 43 public DiscreteValueSetUtilities( 44 Map<DiscreteValue, BigDecimal> valueUtils) { 45 45 if (valueUtils == null) { 46 46 throw new NullPointerException("valueUtils==null"); 47 47 } 48 48 if (valueUtils.keySet().contains(null)) { 49 throw new NullPointerException("one of the keys in valueUtils is null"); 49 throw new NullPointerException( 50 "one of the keys in valueUtils is null"); 50 51 } 51 52 if (valueUtils.values().stream() 52 .anyMatch(v -> v == null || v.compareTo(BigDecimal.ZERO) < 0 || v.compareTo(BigDecimal.ONE) > 0)) { 53 throw new IllegalArgumentException("Weights in valueUtils must all be in [0,1]"); 53 .anyMatch(v -> v == null || v.compareTo(BigDecimal.ZERO) < 0 54 || v.compareTo(BigDecimal.ONE) > 0)) { 55 throw new IllegalArgumentException( 56 "Weights in valueUtils must all be in [0,1]"); 54 57 } 55 58 this.valueUtilities.putAll(valueUtils); … … 68 71 public String isFitting(ValueSet valueset) { 69 72 if (!(valueset instanceof DiscreteValueSet)) { 70 return "The utilities are for a discrete valueset but the given values are " + valueset; 73 return "The utilities are for a discrete valueset but the given values are " 74 + valueset; 71 75 } 72 76 DiscreteValueSet discvalueset = (DiscreteValueSet) valueset; 73 if (!valueUtilities.keySet().equals(new HashSet<>(discvalueset.getValues()))) 74 return "The values in the set " + valueset + " do not match the values mapped to utilities " 77 if (!valueUtilities.keySet() 78 .equals(new HashSet<>(discvalueset.getValues()))) 79 return "The values in the set " + valueset 80 + " do not match the values mapped to utilities " 75 81 + valueUtilities.keySet(); 76 82 return null; … … 79 85 @Override 80 86 public String toString() { 81 return " ValueSetUtilities" + valueUtilities;87 return "DiscreteValueSetUtilities" + valueUtilities; 82 88 } 83 89 … … 86 92 final int prime = 31; 87 93 int result = 1; 88 result = prime * result + ((valueUtilities == null) ? 0 : valueUtilities.hashCode()); 94 result = prime * result 95 + ((valueUtilities == null) ? 0 : valueUtilities.hashCode()); 89 96 return result; 90 97 } -
profile/src/main/java/geniusweb/profile/utilityspace/NumberValueSetUtilities.java
r4 r9 139 139 @Override 140 140 public String toString() { 141 return "NumberVal Utility(" + lowValue + "->" + lowUtility + ","141 return "NumberValueSetUtilities(" + lowValue + "->" + lowUtility + "," 142 142 + highValue + "->" + highUtility + ")"; 143 143 } -
profile/src/test/java/geniusweb/profile/utilityspace/DiscreteValueSetUtilitiesTest.java
r7 r9 3 3 import static org.junit.Assert.assertEquals; 4 4 import static org.junit.Assert.assertFalse; 5 import static org.junit.Assert.assertTrue; 5 6 6 7 import java.io.IOException; … … 81 82 @Override 82 83 public List<String> getGeneralTestStrings() { 83 return Arrays.asList(" ValueSetUtilities\\{\"a\"=0.14\\}",84 " ValueSetUtilities\\{\"b\"=0.37\\}",85 " ValueSetUtilities\\{\"a\"=0.37\\}",86 " ValueSetUtilities\\{\"a\"=0.14, \"b\"=0.37\\}");84 return Arrays.asList("DiscreteValueSetUtilities\\{\"a\"=0.14\\}", 85 "DiscreteValueSetUtilities\\{\"b\"=0.37\\}", 86 "DiscreteValueSetUtilities\\{\"a\"=0.37\\}", 87 "DiscreteValueSetUtilities\\{\"a\"=0.14, \"b\"=0.37\\}"); 87 88 } 88 89 … … 200 201 201 202 } 203 204 @Test 205 public void testDeserializeAsDiscrete() 206 throws JsonParseException, JsonMappingException, IOException { 207 // Check that DiscreteValueSetUtilities properly deserializes 208 // discreteutils. 209 String utilstring = "{\"discreteutils\": {\"valueUtilities\": {\"Party Tent\": 0.52,\"Your Dorm\": 0.23,\"Party Room\": 0.99,\"Ballroom\": 0.77}}}"; 210 DiscreteValueSetUtilities valueutils = jackson.readValue(utilstring, 211 DiscreteValueSetUtilities.class); 212 assertTrue(new BigDecimal("0.23").compareTo( 213 valueutils.getUtility(new DiscreteValue("Your Dorm"))) == 0); 214 215 } 216 202 217 } -
profile/src/test/java/geniusweb/profile/utilityspace/LinearAdditiveTest.java
r7 r9 20 20 21 21 import com.fasterxml.jackson.databind.ObjectMapper; 22 import com.fasterxml.jackson.databind.exc.InvalidDefinitionException;23 22 24 23 import geniusweb.issuevalue.Bid; … … 145 144 public List<String> getGeneralTestStrings() { 146 145 return Arrays.asList( 147 "LinearAdditive\\[\\{issue2= ValueSetUtilities\\{\"issue2value2\"=0.8, \"issue2value1\"=0.6\\}, issue1=ValueSetUtilities\\{\"issue1value1\"=0.3, \"issue1value2\"=0.2\\}\\},\\{issue2=0.6, issue1=0.4\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value2\"\\}\\]",148 "LinearAdditive\\[\\{issue2= ValueSetUtilities\\{\"issue2value2\"=0.8, \"issue2value1\"=0.6\\}, issue1=ValueSetUtilities\\{\"issue1value1\"=0.3, \"issue1value2\"=0.2\\}\\},\\{issue2=0.7, issue1=0.3\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value2\"\\}\\]",149 "LinearAdditive\\[\\{issue2= ValueSetUtilities\\{\"issue2value2\"=0.2, \"issue2value1\"=0.3\\}, issue1=ValueSetUtilities\\{\"issue1value1\"=0.6, \"issue1value2\"=0.8\\}\\},\\{issue2=0.6, issue1=0.4\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value2\"\\}\\]",150 "LinearAdditive\\[\\{issue2= ValueSetUtilities\\{\"issue2value2\"=0.2, \"issue2value1\"=0.3\\}, issue1=ValueSetUtilities\\{\"issue1value1\"=0.6, \"issue1value2\"=0.8\\}\\},\\{issue2=0.6, issue1=0.4\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value1\"\\}\\]");146 "LinearAdditive\\[\\{issue2=DiscreteValueSetUtilities\\{\"issue2value2\"=0.8, \"issue2value1\"=0.6\\}, issue1=DiscreteValueSetUtilities\\{\"issue1value1\"=0.3, \"issue1value2\"=0.2\\}\\},\\{issue2=0.6, issue1=0.4\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value2\"\\}\\]", 147 "LinearAdditive\\[\\{issue2=DiscreteValueSetUtilities\\{\"issue2value2\"=0.8, \"issue2value1\"=0.6\\}, issue1=DiscreteValueSetUtilities\\{\"issue1value1\"=0.3, \"issue1value2\"=0.2\\}\\},\\{issue2=0.7, issue1=0.3\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value2\"\\}\\]", 148 "LinearAdditive\\[\\{issue2=DiscreteValueSetUtilities\\{\"issue2value2\"=0.2, \"issue2value1\"=0.3\\}, issue1=DiscreteValueSetUtilities\\{\"issue1value1\"=0.6, \"issue1value2\"=0.8\\}\\},\\{issue2=0.6, issue1=0.4\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value2\"\\}\\]", 149 "LinearAdditive\\[\\{issue2=DiscreteValueSetUtilities\\{\"issue2value2\"=0.2, \"issue2value1\"=0.3\\}, issue1=DiscreteValueSetUtilities\\{\"issue1value1\"=0.6, \"issue1value2\"=0.8\\}\\},\\{issue2=0.6, issue1=0.4\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value1\"\\}\\]"); 151 150 } 152 151 … … 271 270 } 272 271 273 @Test (expected = InvalidDefinitionException.class)272 @Test 274 273 public void loadFullWithJson() throws IOException { 275 274 String profile = new String( -
profile/src/test/java/geniusweb/profile/utilityspace/NumberValueSetUtilTest.java
r3 r9 44 44 @Override 45 45 public List<String> getGeneralTestStrings() { 46 return Arrays.asList("NumberVal Utility\\(12.5->0.5,18.5->0.9\\)",47 "NumberVal Utility\\(12.5->0.6,18.5->0.9\\)",48 "NumberVal Utility\\(12.5->0.5,18.4->0.9\\)");46 return Arrays.asList("NumberValueSetUtilities\\(12.5->0.5,18.5->0.9\\)", 47 "NumberValueSetUtilities\\(12.5->0.6,18.5->0.9\\)", 48 "NumberValueSetUtilities\\(12.5->0.5,18.4->0.9\\)"); 49 49 } 50 50 -
profile/src/test/resources/party1.json
r7 r9 92 92 "Location": { 93 93 "values": [ 94 "Party Tent '",94 "Party Tent", 95 95 "Your Dorm", 96 96 "Party Room", -
profileconnection/pom.xml
r6 r9 6 6 <groupId>geniusweb</groupId> 7 7 <artifactId>profileconnection</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 31 31 <groupId>geniusweb</groupId> 32 32 <artifactId>profile</artifactId> 33 <version>1. 0.0</version>33 <version>1.1.0</version> 34 34 </dependency> 35 35 -
profileconnection/src/main/java/geniusweb/profileconnection/FileProfileConnector.java
r2 r9 10 10 11 11 import geniusweb.profile.Profile; 12 import tudelft.utilities.listener.DefaultListenable; 12 13 13 14 /** 14 15 * ProfileInterface based on a plain filesystem UTF8 file. 15 16 */ 16 public class FileProfileConnector implements ProfileInterface { 17 public class FileProfileConnector extends DefaultListenable<Profile> 18 implements ProfileInterface { 17 19 private final static ObjectMapper jackson = new ObjectMapper(); 18 20 private final Profile profile; … … 25 27 public FileProfileConnector(String filename) throws IOException { 26 28 Path path = new File(filename).toPath(); 27 String serialized = new String(Files.readAllBytes(path), StandardCharsets.UTF_8); 29 String serialized = new String(Files.readAllBytes(path), 30 StandardCharsets.UTF_8); 28 31 profile = jackson.readValue(serialized, Profile.class); 29 32 } -
profileconnection/src/main/java/geniusweb/profileconnection/ProfileInterface.java
r1 r9 2 2 3 3 import geniusweb.profile.Profile; 4 import tudelft.utilities.listener.Listenable; 4 5 5 6 /** 6 7 * A container holding a modifyable profile. This interface allows testing. 7 8 */ 8 public interface ProfileInterface {9 public interface ProfileInterface extends Listenable<Profile> { 9 10 10 11 /** -
profileconnection/src/main/java/geniusweb/profileconnection/WebsocketProfileConnector.java
r1 r9 15 15 16 16 import geniusweb.profile.Profile; 17 import tudelft.utilities.listener.DefaultListenable; 17 18 import tudelft.utilities.logging.Reporter; 18 19 … … 21 22 */ 22 23 @ClientEndpoint 23 public class WebsocketProfileConnector implements ProfileInterface { 24 public class WebsocketProfileConnector extends DefaultListenable<Profile> 25 implements ProfileInterface { 24 26 private final static ObjectMapper jackson = new ObjectMapper(); 25 27 private static final int TIMEOUT_MS = 2000; … … 56 58 // this will be called every time the profile changes. 57 59 logger.log(Level.FINE, "Received profile: " + message); 58 this.profile = jackson.readValue(message, Profile.class); 60 profile = jackson.readValue(message, Profile.class); 61 notifyListeners(profile); 59 62 } 60 63 -
protocol/pom.xml
r6 r9 6 6 <groupId>geniusweb</groupId> 7 7 <artifactId>protocol</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 31 31 <groupId>geniusweb</groupId> 32 32 <artifactId>profile</artifactId> 33 <version>1. 0.0</version>33 <version>1.1.0</version> 34 34 </dependency> 35 35 <dependency> 36 36 <groupId>geniusweb</groupId> 37 37 <artifactId>party</artifactId> 38 <version>1.0.0</version> 39 </dependency> 40 <dependency> 41 <groupId>tudelft.utilities</groupId> 42 <artifactId>listener</artifactId> 43 <version>1.0.0</version> 38 <version>1.1.0</version> 44 39 </dependency> 45 40 <dependency> 46 41 <groupId>geniusweb</groupId> 47 42 <artifactId>references</artifactId> 48 <version>1. 0.0</version>43 <version>1.1.0</version> 49 44 </dependency> 50 45 <dependency> 51 46 <groupId>geniusweb</groupId> 52 47 <artifactId>events</artifactId> 53 <version>1. 0.0</version>48 <version>1.1.0</version> 54 49 </dependency> 55 50 <dependency> … … 62 57 <artifactId>logging</artifactId> 63 58 <version>1.0.0</version> 59 </dependency> 60 <dependency> 61 <groupId>tudelft.utilities</groupId> 62 <artifactId>listener</artifactId> 63 <version>1.1.0</version> 64 64 </dependency> 65 65 … … 160 160 </configuration> 161 161 </plugin> 162 162 <plugin> 163 <groupId>org.apache.maven.plugins</groupId> 164 <artifactId>maven-enforcer-plugin</artifactId> 165 <version>3.0.0-M2</version> 166 <executions> 167 <execution> 168 <id>enforce</id> 169 <configuration> 170 <rules> 171 <dependencyConvergence /> 172 </rules> 173 </configuration> 174 <goals> 175 <goal>enforce</goal> 176 </goals> 177 </execution> 178 </executions> 179 </plugin> 163 180 <plugin> 164 181 <groupId>org.apache.maven.plugins</groupId> -
protocol/src/main/java/geniusweb/protocol/NegoProtocol.java
r1 r9 10 10 import geniusweb.events.CurrentState; 11 11 import geniusweb.events.ProtocolEvent; 12 import geniusweb.protocol.partyconnection. ConnectionWithPartyFactory;12 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 13 13 import geniusweb.protocol.session.SessionProtocol; 14 14 import geniusweb.protocol.session.SessionSettings; … … 70 70 * 71 71 * 72 * @param connectionfactory the {@link ConnectionWithPartyFactory} that allows72 * @param connectionfactory the {@link ProtocolToPartyConnFactory} that allows 73 73 * the protocol to connect with the {@link Reference}s 74 74 * in the settings 75 75 */ 76 void start( ConnectionWithPartyFactory connectionfactory);76 void start(ProtocolToPartyConnFactory connectionfactory); 77 77 78 78 /** -
protocol/src/main/java/geniusweb/protocol/session/DefaultSessionState.java
r1 r9 10 10 import geniusweb.progress.Progress; 11 11 import geniusweb.protocol.ProtocolException; 12 import geniusweb.protocol.partyconnection. ConnectionWithParties;12 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 13 13 import geniusweb.references.PartyWithProfile; 14 14 … … 19 19 private final List<Action> actions; 20 20 21 private final transient ConnectionWithParties connections;21 private final transient ProtocolToPartyConnections connections; 22 22 23 23 private final Progress progress; … … 60 60 */ 61 61 public DefaultSessionState(List<Action> actions, 62 ConnectionWithParties conns, Progress progr,62 ProtocolToPartyConnections conns, Progress progr, 63 63 SessionSettings settings, 64 64 Map<PartyId, PartyWithProfile> partyprofiles, ProtocolException e) { … … 67 67 } 68 68 if (conns == null) { 69 this.connections = new ConnectionWithParties(69 this.connections = new ProtocolToPartyConnections( 70 70 Collections.EMPTY_LIST); 71 71 } else { … … 92 92 * @return existing connections. 93 93 */ 94 public ConnectionWithParties getConnections() {94 public ProtocolToPartyConnections getConnections() { 95 95 return connections; 96 96 } -
protocol/src/main/java/geniusweb/protocol/session/saop/SAOP.java
r8 r9 23 23 import geniusweb.protocol.CurrentNegoState; 24 24 import geniusweb.protocol.ProtocolException; 25 import geniusweb.protocol.partyconnection. ConnectionWithParty;26 import geniusweb.protocol.partyconnection. ConnectionWithPartyFactory;25 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 26 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 27 27 import geniusweb.protocol.session.SessionProtocol; 28 28 import geniusweb.protocol.session.SessionSettings; … … 95 95 @Override 96 96 public synchronized void start( 97 ConnectionWithPartyFactory connectionfactory) {97 ProtocolToPartyConnFactory connectionfactory) { 98 98 99 99 try { … … 151 151 */ 152 152 protected synchronized void connect( 153 ConnectionWithPartyFactory connectionfactory)153 ProtocolToPartyConnFactory connectionfactory) 154 154 throws InterruptedException, IOException { 155 155 List<PartyWithProfile> participants = state.getSettings() … … 158 158 .map(parti -> (parti.getParty().getPartyRef())) 159 159 .collect(Collectors.toList()); 160 List< ConnectionWithParty> connections = null;160 List<ProtocolToPartyConn> connections = null; 161 161 log.log(Level.INFO, "SAOP connect " + parties); 162 162 while (connections == null) { … … 218 218 */ 219 219 protected synchronized void setupParties() throws ProtocolException { 220 for ( ConnectionWithPartyconn : state.getConnections()) {220 for (ProtocolToPartyConn conn : state.getConnections()) { 221 221 conn.addListener(action -> actionRequest(conn, action)); 222 222 } 223 223 224 for ( ConnectionWithPartyconnection : state.getConnections()) {224 for (ProtocolToPartyConn connection : state.getConnections()) { 225 225 try { 226 226 sendSettings(connection); … … 239 239 * @throws IOException if party got disconnected 240 240 */ 241 private synchronized void sendSettings( ConnectionWithPartyconnection)241 private synchronized void sendSettings(ProtocolToPartyConn connection) 242 242 throws IOException { 243 243 PartyId partyid = connection.getParty(); … … 261 261 */ 262 262 protected synchronized void actionRequest( 263 final ConnectionWithPartypartyconn, final Action action) {263 final ProtocolToPartyConn partyconn, final Action action) { 264 264 if (action == null) { 265 handleError(partyconn 266 + " did null action, breaching the protocol. Closing session", 267 partyconn.getParty().getName(), null); 265 Throwable err = partyconn.getError(); 266 if (err == null) { 267 err = new ProtocolException("Party sent a null action", 268 partyconn.getParty().getName()); 269 } 270 handleError(partyconn + "Protocol error", 271 partyconn.getParty().getName(), err); 268 272 return; 269 273 } … … 348 352 return; 349 353 Inform finished = new Finished(state.getAgreement()); 350 for ( ConnectionWithPartyconn : state.getConnections()) {354 for (ProtocolToPartyConn conn : state.getConnections()) { 351 355 sendFinish(conn, finished); 352 356 } 353 notify Change(new CurrentNegoState(state));354 } 355 356 private void sendFinish( ConnectionWithPartyconnection, Inform finished) {357 notifyListeners(new CurrentNegoState(state)); 358 } 359 360 private void sendFinish(ProtocolToPartyConn connection, Inform finished) { 357 361 try { 358 362 connection.send(finished); -
protocol/src/main/java/geniusweb/protocol/session/saop/SAOPState.java
r4 r9 16 16 import geniusweb.progress.ProgressRounds; 17 17 import geniusweb.protocol.ProtocolException; 18 import geniusweb.protocol.partyconnection. ConnectionWithParties;19 import geniusweb.protocol.partyconnection. ConnectionWithParty;18 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 19 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 20 20 import geniusweb.protocol.session.DefaultSessionState; 21 21 import geniusweb.protocol.session.SessionSettings; … … 42 42 * occurred. 43 43 */ 44 public SAOPState(List<Action> actions, ConnectionWithParties conns,44 public SAOPState(List<Action> actions, ProtocolToPartyConnections conns, 45 45 Progress progress, SessionSettings settings, 46 46 Map<PartyId, PartyWithProfile> partyprofiles, ProtocolException e) { … … 55 55 public SAOPState(SAOPSettings settings) { 56 56 this(Collections.emptyList(), 57 new ConnectionWithParties(Collections.emptyList()), null,57 new ProtocolToPartyConnections(Collections.emptyList()), null, 58 58 settings, null, null); 59 59 … … 82 82 /** 83 83 * 84 * @param connection the new {@link ConnectionWithParty}84 * @param connection the new {@link ProtocolToPartyConn} 85 85 * @param partyprofile the {@link PartyWithProfile} that is associated with 86 86 * this state … … 91 91 * state currently indicate if that already happened or not. 92 92 */ 93 public SAOPState with( ConnectionWithPartyconnection,93 public SAOPState with(ProtocolToPartyConn connection, 94 94 PartyWithProfile partyprofile) { 95 95 // Only called from the SAOP initialization phase. 96 ConnectionWithParties newconns = getConnections().with(connection);96 ProtocolToPartyConnections newconns = getConnections().with(connection); 97 97 Map<PartyId, PartyWithProfile> newprofiles = new HashMap<>( 98 98 getPartyProfiles()); -
protocol/src/main/java/geniusweb/protocol/tournament/allpermutations/AllPermutationsProtocol.java
r1 r9 7 7 import geniusweb.protocol.CurrentNegoState; 8 8 import geniusweb.protocol.SessionResult; 9 import geniusweb.protocol.partyconnection. ConnectionWithPartyFactory;9 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 10 10 import geniusweb.protocol.session.SessionProtocol; 11 11 import geniusweb.protocol.session.SessionSettings; … … 29 29 private final transient Reporter log; 30 30 31 private ConnectionWithPartyFactory connectionFactory; // FINAL31 private ProtocolToPartyConnFactory connectionFactory; // FINAL 32 32 private AllPermutationsState state; // MUTABLE 33 33 … … 45 45 46 46 @Override 47 public void start( ConnectionWithPartyFactory connectionfactory) {47 public void start(ProtocolToPartyConnFactory connectionfactory) { 48 48 this.connectionFactory = connectionfactory; 49 notify Change(new TournamentStarted(state.getSize().longValue()));49 notifyListeners(new TournamentStarted(state.getSize().longValue())); 50 50 startNextSession(); 51 51 } … … 85 85 sessionstate.getAgreement(), sessionstate.getError()); 86 86 state = state.with(result); 87 notify Change(new CurrentNegoState(state));87 notifyListeners(new CurrentNegoState(state)); 88 88 if (!state.isFinal(now)) { 89 89 startNextSession(); -
protocol/src/test/java/geniusweb/protocol/session/ConnectionWithPartiesTest.java
r1 r9 14 14 15 15 import geniusweb.actions.PartyId; 16 import geniusweb.protocol.partyconnection. ConnectionWithParties;17 import geniusweb.protocol.partyconnection. ConnectionWithParty;16 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 17 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 18 18 import tudelft.utilities.junit.GeneralTests; 19 19 20 20 public class ConnectionWithPartiesTest 21 extends GeneralTests< ConnectionWithParties> {21 extends GeneralTests<ProtocolToPartyConnections> { 22 22 PartyId party1 = new PartyId("party1"); 23 23 PartyId party2 = new PartyId("party2"); 24 24 PartyId party3 = new PartyId("party3"); 25 25 26 private ConnectionWithParty con1 = mock(ConnectionWithParty.class);27 private ConnectionWithParty con2 = mock(ConnectionWithParty.class);28 private ConnectionWithParty con3 = mock(ConnectionWithParty.class);26 private ProtocolToPartyConn con1 = mock(ProtocolToPartyConn.class); 27 private ProtocolToPartyConn con2 = mock(ProtocolToPartyConn.class); 28 private ProtocolToPartyConn con3 = mock(ProtocolToPartyConn.class); 29 29 30 private ConnectionWithParties conns1 = new ConnectionWithParties(30 private ProtocolToPartyConnections conns1 = new ProtocolToPartyConnections( 31 31 Arrays.asList(con1, con2)); 32 private ConnectionWithParties conns1a = new ConnectionWithParties(32 private ProtocolToPartyConnections conns1a = new ProtocolToPartyConnections( 33 33 Arrays.asList(con1, con2)); 34 private ConnectionWithParties conns2 = new ConnectionWithParties(34 private ProtocolToPartyConnections conns2 = new ProtocolToPartyConnections( 35 35 Arrays.asList(con1, con3)); 36 private ConnectionWithParties conns3 = new ConnectionWithParties(36 private ProtocolToPartyConnections conns3 = new ProtocolToPartyConnections( 37 37 Arrays.asList(con2, con1)); 38 private ConnectionWithParties conns4 = new ConnectionWithParties(38 private ProtocolToPartyConnections conns4 = new ProtocolToPartyConnections( 39 39 Arrays.asList(con2, con1, con3)); 40 private ConnectionWithParties conns5 = new ConnectionWithParties(40 private ProtocolToPartyConnections conns5 = new ProtocolToPartyConnections( 41 41 Arrays.asList(con2, con1, con3, con1)); 42 42 … … 54 54 55 55 @Override 56 public List<List< ConnectionWithParties>> getGeneralTestData() {56 public List<List<ProtocolToPartyConnections>> getGeneralTestData() { 57 57 return Arrays.asList(Arrays.asList(conns1, conns1a), 58 58 Arrays.asList(conns2), Arrays.asList(conns3), … … 98 98 @Test 99 99 public void withPartyTest() { 100 ConnectionWithParties conns = conns3.with(con3);100 ProtocolToPartyConnections conns = conns3.with(con3); 101 101 assertEquals(2, conns3.size()); 102 102 assertEquals(3, conns.size()); -
protocol/src/test/java/geniusweb/protocol/session/DefaultSessionStateTest.java
r8 r9 27 27 import geniusweb.progress.ProgressTime; 28 28 import geniusweb.protocol.ProtocolException; 29 import geniusweb.protocol.partyconnection. ConnectionWithParties;29 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 30 30 import geniusweb.protocol.session.saop.SAOPSettings; 31 31 import geniusweb.references.Parameters; … … 48 48 PartyId party1 = new PartyId("party1"); 49 49 actions.add(new EndNegotiation(party1)); 50 ConnectionWithParties conns = new ConnectionWithParties(50 ProtocolToPartyConnections conns = new ProtocolToPartyConnections( 51 51 Collections.EMPTY_LIST); 52 52 DeadlineTime deadline = new DeadlineTime(1000); … … 126 126 127 127 public DefaultSessionState1(List<Action> actions, 128 ConnectionWithParties conns, Progress progr,128 ProtocolToPartyConnections conns, Progress progr, 129 129 SessionSettings settings, 130 130 Map<PartyId, PartyWithProfile> partyprofiles, ProtocolException e) { -
protocol/src/test/java/geniusweb/protocol/session/saop/SAOPStateTest.java
r4 r9 27 27 import geniusweb.progress.ProgressTime; 28 28 import geniusweb.protocol.ProtocolException; 29 import geniusweb.protocol.partyconnection. ConnectionWithParties;30 import geniusweb.protocol.partyconnection. ConnectionWithParty;29 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 30 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 31 31 import geniusweb.protocol.session.SessionSettings; 32 32 import tudelft.utilities.junit.GeneralTests; … … 42 42 private List<Action> actions2 = Arrays.asList(action); 43 43 44 private ConnectionWithParty party1conn = mock(ConnectionWithParty.class);45 private ConnectionWithParty party2conn = mock(ConnectionWithParty.class);46 private ConnectionWithParty party3conn = mock(ConnectionWithParty.class);47 48 private ConnectionWithParties connections = new ConnectionWithParties(44 private ProtocolToPartyConn party1conn = mock(ProtocolToPartyConn.class); 45 private ProtocolToPartyConn party2conn = mock(ProtocolToPartyConn.class); 46 private ProtocolToPartyConn party3conn = mock(ProtocolToPartyConn.class); 47 48 private ProtocolToPartyConnections connections = new ProtocolToPartyConnections( 49 49 Arrays.asList(party1conn, party2conn)); 50 private ConnectionWithParties connections2 = new ConnectionWithParties(50 private ProtocolToPartyConnections connections2 = new ProtocolToPartyConnections( 51 51 Arrays.asList(party1conn, party3conn)); 52 private ConnectionWithParties connections3 = new ConnectionWithParties(52 private ProtocolToPartyConnections connections3 = new ProtocolToPartyConnections( 53 53 Arrays.asList(party1conn, party2conn, party3conn)); 54 54 … … 114 114 @Test 115 115 public void constructWith0Connection() { 116 new SAOPState(actions, new ConnectionWithParties(Arrays.asList()),116 new SAOPState(actions, new ProtocolToPartyConnections(Arrays.asList()), 117 117 progresstime, settings, null, null); 118 118 } … … 132 132 @Test 133 133 public void testNextActor2() { 134 ConnectionWithParties conns = new ConnectionWithParties(134 ProtocolToPartyConnections conns = new ProtocolToPartyConnections( 135 135 Arrays.asList(party2conn, party3conn)); 136 136 SAOPState state = new SAOPState(actions, conns, progresstime, settings, -
protocol/src/test/java/geniusweb/protocol/session/saop/SAOPTest.java
r8 r9 39 39 import geniusweb.progress.Progress; 40 40 import geniusweb.protocol.ProtocolException; 41 import geniusweb.protocol.partyconnection. ConnectionWithParties;42 import geniusweb.protocol.partyconnection. ConnectionWithParty;43 import geniusweb.protocol.partyconnection. ConnectionWithPartyFactory;41 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections; 42 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 43 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 44 44 import geniusweb.references.Parameters; 45 45 import geniusweb.references.PartyRef; … … 76 76 private final PartyWithProfile party2 = mock(PartyWithProfile.class); 77 77 private SAOP saop; 78 private ConnectionWithPartyFactory factory;78 private ProtocolToPartyConnFactory factory; 79 79 private List connections; 80 private ConnectionWithParty conn1 = mock(ConnectionWithParty.class),81 conn2 = mock( ConnectionWithParty.class);80 private ProtocolToPartyConn conn1 = mock(ProtocolToPartyConn.class), 81 conn2 = mock(ProtocolToPartyConn.class); 82 82 private Map<PartyId, PartyWithProfile> partyprofiles; 83 83 private Progress progress = mock(Progress.class); 84 84 private ProfileRef profile1; 85 85 private ProfileRef profile2; 86 private ConnectionWithParties connectionswithparties = mock(87 ConnectionWithParties.class);;86 private ProtocolToPartyConnections connectionswithparties = mock( 87 ProtocolToPartyConnections.class);; 88 88 @SuppressWarnings("unchecked") 89 89 private final Listener<ProtocolEvent> testlistener = mock(Listener.class); … … 116 116 when(settings.getDeadline()).thenReturn(deadlinetime); 117 117 118 factory = mock( ConnectionWithPartyFactory.class);118 factory = mock(ProtocolToPartyConnFactory.class); 119 119 connections = mock(List.class); 120 120 when(factory.connect(any(List.class))).thenReturn(connections); … … 159 159 when(state.getPartyProfiles()).thenReturn(partyprofiles); 160 160 when(state.getProgress()).thenReturn(progress); 161 when(state.with(any( ConnectionWithParty.class),161 when(state.with(any(ProtocolToPartyConn.class), 162 162 any(PartyWithProfile.class))).thenReturn(connectedstate); 163 163 when(state.getNextActor()).thenReturn(PARTY1ID); -
protocol/src/test/java/geniusweb/protocol/tournament/AllPermutationsProtocolTest.java
r1 r9 24 24 import geniusweb.protocol.NegoState; 25 25 import geniusweb.protocol.SessionResult; 26 import geniusweb.protocol.partyconnection. ConnectionWithPartyFactory;26 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 27 27 import geniusweb.protocol.session.SessionProtocol; 28 28 import geniusweb.protocol.session.SessionSettings; … … 42 42 private final AllPermutationsProtocol app = new AllPermutationsProtocol( 43 43 state, log); 44 private final ConnectionWithPartyFactory factory = mock(45 ConnectionWithPartyFactory.class);44 private final ProtocolToPartyConnFactory factory = mock( 45 ProtocolToPartyConnFactory.class); 46 46 private final SessionSettings settings = mock(SessionSettings.class); 47 47 private final SessionState finalsessionstate = mock(SessionState.class); … … 140 140 141 141 @Override 142 public void start( ConnectionWithPartyFactory connectionfactory) {142 public void start(ProtocolToPartyConnFactory connectionfactory) { 143 143 144 144 } -
pythonadapter/pom.xml
r1 r9 6 6 <groupId>geniusweb</groupId> 7 7 <artifactId>pythonadapter</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 31 31 <groupId>geniusweb</groupId> 32 32 <artifactId>party</artifactId> 33 <version>1. 0.0</version>33 <version>1.1.0</version> 34 34 </dependency> 35 35 -
pythonadapter/src/main/java/geniusweb/pythonadapter/PythonPartyAdapter.java
r1 r9 7 7 8 8 import geniusweb.actions.Action; 9 import geniusweb.connection.Connection ;9 import geniusweb.connection.ConnectionEnd; 10 10 import geniusweb.party.Capabilities; 11 11 import geniusweb.party.DefaultParty; … … 104 104 105 105 @Override 106 public void connect(Connection <Inform, Action> connection) {106 public void connect(ConnectionEnd<Inform, Action> connection) { 107 107 pyparty.connect(connection); 108 108 } -
references/pom.xml
r6 r9 6 6 <groupId>geniusweb</groupId> 7 7 <artifactId>references</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 31 31 <groupId>tudelft.utilities</groupId> 32 32 <artifactId>listener</artifactId> 33 <version>1. 0.0</version>33 <version>1.1.0</version> 34 34 </dependency> 35 35 -
references/src/main/java/geniusweb/connection/Connectable.java
r1 r9 2 2 3 3 /** 4 * a socket for a general two-way connection 4 * A Connectable is an object that can connect on request with a provided 5 * {@link ConnectionEnd} and then respond to incoming and outgong signals. 5 6 * 6 * @param <INTYPE> the type of incoming messages7 * @param <INTYPE> the type of incoming messages 7 8 * @param <OUTTYPE> the type of outgoing messages 8 9 */ … … 13 14 * @param connection the new connection 14 15 */ 15 void connect(Connection <INTYPE, OUTTYPE> connection);16 void connect(ConnectionEnd<INTYPE, OUTTYPE> connection); 16 17 17 18 /** -
references/src/main/java/geniusweb/connection/ConnectionFactory.java
r1 r9 9 9 * factory that can turn a {@link Reference} into a connection to that 10 10 * reference. 11 * 11 12 * 12 13 * @param <INTYPE> the type of incoming messages. Incoming messages are … … 30 31 * the server. This suggest to retry later. 31 32 */ 32 Connection <INTYPE, OUTTYPE> connect(Reference reference)33 ConnectionEnd<INTYPE, OUTTYPE> connect(Reference reference) 33 34 throws IOException, NoResourcesNowException; 34 35 -
references/src/main/java/geniusweb/connection/DefaultConnection.java
r1 r9 14 14 */ 15 15 public abstract class DefaultConnection<INTYPE, OUTTYPE> extends 16 DefaultListenable<INTYPE> implements Connection <INTYPE, OUTTYPE> {16 DefaultListenable<INTYPE> implements ConnectionEnd<INTYPE, OUTTYPE> { 17 17 } -
simplerunner/pom.xml
r6 r9 6 6 <groupId>geniusweb</groupId> 7 7 <artifactId>simplerunner</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 16 16 <basedir>.</basedir> 17 17 <passwd>${env.ARTIFACTORY_PASS}</passwd> 18 <jackson-2-version>2.9. 6</jackson-2-version>18 <jackson-2-version>2.9.10</jackson-2-version> 19 19 </properties> 20 20 … … 31 31 <groupId>geniusweb</groupId> 32 32 <artifactId>protocol</artifactId> 33 <version>1. 0.0</version>33 <version>1.1.0</version> 34 34 </dependency> 35 35 <dependency> 36 36 <groupId>geniusweb</groupId> 37 37 <artifactId>party</artifactId> 38 <version>1. 0.0</version>38 <version>1.1.0</version> 39 39 </dependency> 40 40 <dependency> 41 41 <groupId>geniusweb.exampleparties</groupId> 42 42 <artifactId>randomparty</artifactId> 43 <version>1.0.0</version> 43 <version>1.1.0</version> 44 <scope>test</scope> 44 45 </dependency> 45 46 … … 98 99 </configuration> 99 100 </plugin> 100 101 <plugin> 102 <groupId>org.apache.maven.plugins</groupId> 103 <artifactId>maven-enforcer-plugin</artifactId> 104 <version>3.0.0-M2</version> 105 <executions> 106 <execution> 107 <id>enforce</id> 108 <configuration> 109 <rules> 110 <dependencyConvergence /> 111 </rules> 112 </configuration> 113 <goals> 114 <goal>enforce</goal> 115 </goals> 116 </execution> 117 </executions> 118 </plugin> 101 119 <plugin> 102 120 <groupId>org.apache.maven.plugins</groupId> -
simplerunner/src/main/java/geniusweb/simplerunner/BasicConnection.java
r1 r9 4 4 import java.net.URI; 5 5 6 import geniusweb.connection.Connection ;6 import geniusweb.connection.ConnectionEnd; 7 7 import geniusweb.references.Reference; 8 8 import tudelft.utilities.listener.DefaultListenable; … … 17 17 */ 18 18 public class BasicConnection<IN, OUT> extends DefaultListenable<IN> 19 implements Connection <IN, OUT> {19 implements ConnectionEnd<IN, OUT> { 20 20 private final Reference reference; 21 21 private final URI uri; -
simplerunner/src/main/java/geniusweb/simplerunner/ClassPathConnectionFactory.java
r1 r9 13 13 import geniusweb.party.Party; 14 14 import geniusweb.party.inform.Inform; 15 import geniusweb.protocol.partyconnection. ConnectionWithParty;16 import geniusweb.protocol.partyconnection. ConnectionWithPartyFactory;15 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 16 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 17 17 import geniusweb.references.Reference; 18 18 import tudelft.utilities.repository.NoResourcesNowException; … … 25 25 * 26 26 */ 27 public class ClassPathConnectionFactory implements ConnectionWithPartyFactory {27 public class ClassPathConnectionFactory implements ProtocolToPartyConnFactory { 28 28 private static final String SCHEME = "classpath"; 29 29 private static int serialcounter = 1; … … 31 31 32 32 @Override 33 public ConnectionWithPartyconnect(Reference reference) {33 public ProtocolToPartyConn connect(Reference reference) { 34 34 // set up the whole other party including the connection to it. 35 35 String classpath = getClassPath(reference.getURI()); … … 42 42 uri("classpath:" + reference.getURI().getSchemeSpecificPart() 43 43 + "." + (serialcounter++))); 44 party2protocol.init(action -> protocol2party.notify Change(action));45 protocol2party.init(info -> party2protocol.notify Change(info));44 party2protocol.init(action -> protocol2party.notifyListeners(action)); 45 protocol2party.init(info -> party2protocol.notifyListeners(info)); 46 46 47 47 party.connect(party2protocol); … … 102 102 103 103 @Override 104 public List< ConnectionWithParty> connect(List<Reference> references)104 public List<ProtocolToPartyConn> connect(List<Reference> references) 105 105 throws IOException, NoResourcesNowException { 106 List< ConnectionWithParty> connections = new LinkedList<>();106 List<ProtocolToPartyConn> connections = new LinkedList<>(); 107 107 for (Reference partyref : references) { 108 108 connections.add(connect(partyref)); … … 114 114 115 115 class BasicConnectionWithParty extends BasicConnection<Action, Inform> 116 implements ConnectionWithParty{116 implements ProtocolToPartyConn { 117 117 118 118 private PartyId id; -
simplerunner/src/main/java/geniusweb/simplerunner/NegoRunner.java
r1 r9 13 13 import geniusweb.protocol.NegoProtocol; 14 14 import geniusweb.protocol.NegoSettings; 15 import geniusweb.protocol.partyconnection. ConnectionWithPartyFactory;15 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 16 16 import geniusweb.protocol.session.SessionSettings; 17 17 import tudelft.utilities.logging.ReportToLogger; … … 27 27 private final NegoSettings settings; 28 28 private final NegoProtocol protocol; 29 private final ConnectionWithPartyFactory connectionfactory;29 private final ProtocolToPartyConnFactory connectionfactory; 30 30 private final Reporter log; 31 31 private final static ObjectMapper jackson = new ObjectMapper(); 32 32 33 33 public NegoRunner(NegoSettings settings, 34 ConnectionWithPartyFactory connectionfactory, Reporter logger) {34 ProtocolToPartyConnFactory connectionfactory, Reporter logger) { 35 35 if (settings == null || connectionfactory == null) { 36 36 throw new NullPointerException("Arguments must be not null"); -
simplerunner/src/test/java/geniusweb/simplerunner/ClassPathConnectionFactoryTest.java
r1 r9 10 10 11 11 import geniusweb.actions.Action; 12 import geniusweb.connection.Connection ;12 import geniusweb.connection.ConnectionEnd; 13 13 import geniusweb.party.inform.Inform; 14 14 import geniusweb.references.PartyRef; … … 42 42 @Test 43 43 public void testRandomParty() throws IOException, URISyntaxException { 44 Connection <Action, Inform> party = factory.connect(new PartyRef(44 ConnectionEnd<Action, Inform> party = factory.connect(new PartyRef( 45 45 "classpath:geniusweb.exampleparties.randomparty.RandomParty")); 46 46 assertNotNull(party); -
simplerunner/src/test/java/geniusweb/simplerunner/SessionRunnerTest.java
r1 r9 18 18 import geniusweb.protocol.CurrentNegoState; 19 19 import geniusweb.protocol.ProtocolException; 20 import geniusweb.protocol.partyconnection. ConnectionWithPartyFactory;20 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 21 21 import geniusweb.protocol.session.SessionProtocol; 22 22 import geniusweb.protocol.session.SessionSettings; … … 47 47 public void smokeTest() { 48 48 new NegoRunner(mock(SessionSettings.class), 49 mock( ConnectionWithPartyFactory.class), logger);49 mock(ProtocolToPartyConnFactory.class), logger); 50 50 } 51 51 … … 56 56 when(settings.getProtocol(logger)).thenReturn(protocol); 57 57 @SuppressWarnings("unchecked") 58 ConnectionWithPartyFactory factory = mock(59 ConnectionWithPartyFactory.class);58 ProtocolToPartyConnFactory factory = mock( 59 ProtocolToPartyConnFactory.class); 60 60 61 61 NegoRunner runner = spy( … … 80 80 Reporter logger = mock(Reporter.class); 81 81 @SuppressWarnings("unchecked") 82 ConnectionWithPartyFactory factory = mock(83 ConnectionWithPartyFactory.class);82 ProtocolToPartyConnFactory factory = mock( 83 ProtocolToPartyConnFactory.class); 84 84 NegoRunner runner = spy( 85 85 new NegoRunner(settings, factory, logger)); … … 107 107 when(protocol.getState()).thenReturn(state); 108 108 @SuppressWarnings("unchecked") 109 ConnectionWithPartyFactory factory = mock(110 ConnectionWithPartyFactory.class);109 ProtocolToPartyConnFactory factory = mock( 110 ProtocolToPartyConnFactory.class); 111 111 NegoRunner runner = spy( 112 112 new NegoRunner(settings, factory, logger)); -
timeline/pom.xml
r6 r9 6 6 <groupId>geniusweb</groupId> 7 7 <artifactId>timeline</artifactId> 8 <version>1. 0.0</version>8 <version>1.1.0</version> 9 9 <packaging>jar</packaging> 10 10 … … 15 15 <basedir>.</basedir> 16 16 <passwd>${env.ARTIFACTORY_PASS}</passwd> 17 <jackson-2-version>2.9. 6</jackson-2-version>17 <jackson-2-version>2.9.10</jackson-2-version> 18 18 </properties> 19 19
Note:
See TracChangeset
for help on using the changeset viewer.