Changeset 9


Ignore:
Timestamp:
11/28/19 14:40:48 (4 years ago)
Author:
bart
Message:

Release 1.1.0

Files:
34 added
55 edited

Legend:

Unmodified
Added
Removed
  • bidspace/pom.xml

    r6 r9  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>bidspace</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1515                <basedir>.</basedir>
    1616                <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>
    1818        </properties>
    1919
     
    3636                        <groupId>geniusweb</groupId>
    3737                        <artifactId>profile</artifactId>
    38                         <version>1.0.0</version>
     38                        <version>1.1.0</version>
    3939                </dependency>
    4040
  • events/pom.xml

    r6 r9  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>events</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
     
    4343                        <groupId>geniusweb</groupId>
    4444                        <artifactId>issuevalue</artifactId>
    45                         <version>1.0.0</version>
     45                        <version>1.1.0</version>
    4646                </dependency>
    4747                <dependency>
    4848                        <groupId>geniusweb</groupId>
    4949                        <artifactId>references</artifactId>
    50                         <version>1.0.0</version>
     50                        <version>1.1.0</version>
    5151                </dependency>
    5252
  • exampleparties/boulware/pom.xml

    r6 r9  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>boulware</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
     
    3333                        <groupId>geniusweb.exampleparties</groupId>
    3434                        <artifactId>timedependentparty</artifactId>
    35                         <version>1.0.0</version>
     35                        <version>1.1.0</version>
    3636                </dependency>
    3737                <dependency>
  • exampleparties/conceder/pom.xml

    r6 r9  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>conceder</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
     
    3333                        <groupId>geniusweb.exampleparties</groupId>
    3434                        <artifactId>timedependentparty</artifactId>
    35                         <version>1.0.0</version>
     35                        <version>1.1.0</version>
    3636                </dependency>
    3737                <dependency>
  • exampleparties/hardliner/pom.xml

    r6 r9  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>hardliner</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
     
    3333                        <groupId>geniusweb.exampleparties</groupId>
    3434                        <artifactId>timedependentparty</artifactId>
    35                         <version>1.0.0</version>
     35                        <version>1.1.0</version>
    3636                </dependency>
    3737                <dependency>
  • exampleparties/linear/pom.xml

    r4 r9  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>linear</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
     
    3333                        <groupId>geniusweb.exampleparties</groupId>
    3434                        <artifactId>timedependentparty</artifactId>
    35                         <version>1.0.0</version>
     35                        <version>1.1.0</version>
    3636                </dependency>
    3737                <dependency>
  • exampleparties/randomparty/pom.xml

    r6 r9  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>randomparty</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    3333                        <groupId>geniusweb</groupId>
    3434                        <artifactId>party</artifactId>
    35                         <version>1.0.0</version>
     35                        <version>1.1.0</version>
    3636                </dependency>
    3737
     
    3939                        <groupId>geniusweb</groupId>
    4040                        <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>
    4247                </dependency>
    4348                <dependency>
    4449                        <groupId>tudelft.utilities</groupId>
    4550                        <artifactId>logging</artifactId>
    46                         <version>1.0.0</version>
    47                 </dependency>
    48                 <dependency>
    49                         <groupId>geniusweb</groupId>
    50                         <artifactId>profileconnection</artifactId>
    5151                        <version>1.0.0</version>
    5252                </dependency>
  • exampleparties/randomparty/src/main/java/geniusweb/exampleparties/randomparty/RandomParty.java

    r2 r9  
    2525import geniusweb.profile.PartialOrdering;
    2626import geniusweb.profile.Profile;
    27 import geniusweb.profile.utilityspace.LinearAdditiveUtilitySpace;
     27import geniusweb.profile.utilityspace.UtilitySpace;
    2828import geniusweb.profileconnection.ProfileConnectionFactory;
    2929import geniusweb.profileconnection.ProfileInterface;
     
    5757                        if (info instanceof Settings) {
    5858                                Settings settings = (Settings) info;
    59                                 this.profileint = ProfileConnectionFactory.create(settings.getProfile().getURI(), getReporter());
     59                                this.profileint = ProfileConnectionFactory
     60                                                .create(settings.getProfile().getURI(), getReporter());
    6061                                this.me = settings.getID();
    6162                                this.progress = settings.getProgress();
     
    7475                        }
    7576                } catch (Exception e) {
    76                         getReporter().log(Level.SEVERE, "Failed to handle info", e);
     77                        throw new RuntimeException("Failed to handle info", e);
    7778                }
    7879        }
     
    8182        public Capabilities getCapabilities() {
    8283                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")))));
    8486                } 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);
    8689                        return null;
    8790                }
     
    99102                } else {
    100103                        // 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());
    102106                        Bid bid = null;
    103107                        for (int attempt = 0; attempt < 20 && !isGood(bid); attempt++) {
     
    115119                        return false;
    116120                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;
    119123                }
    120124                if (profile instanceof PartialOrdering) {
    121                         return ((PartialOrdering) profile).isPreferredOrEqual(bid, profile.getReservationBid());
     125                        return ((PartialOrdering) profile).isPreferredOrEqual(bid,
     126                                        profile.getReservationBid());
    122127                }
    123                 throw new IllegalArgumentException("Can not handle profile type " + profile.getClass());
     128                throw new IllegalArgumentException(
     129                                "Can not handle profile type " + profile.getClass());
    124130        }
    125131
  • exampleparties/randomparty/src/test/java/geniusweb/exampleparties/randomparty/RandomPartyTest.java

    r8 r9  
    3333import geniusweb.actions.PartyId;
    3434import geniusweb.bidspace.AllBidsList;
    35 import geniusweb.connection.Connection;
     35import geniusweb.connection.ConnectionEnd;
    3636import geniusweb.issuevalue.Bid;
    3737import geniusweb.party.Capabilities;
     
    107107        public void testInformSettings() {
    108108                party.connect(connection);
    109                 connection.notifyChange(settings);
     109                connection.notifyListeners(settings);
    110110                assertEquals(0, connection.getActions().size());
    111111        }
     
    199199 */
    200200class TestConnection extends DefaultListenable<Inform>
    201                 implements Connection<Inform, Action> {
     201                implements ConnectionEnd<Inform, Action> {
    202202        private List<Action> actions = new LinkedList<>();
    203203
  • exampleparties/randompartypy/pom.xml

    r6 r9  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>randompyparty</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
     
    3131                        <groupId>geniusweb</groupId>
    3232                        <artifactId>pythonadapter</artifactId>
    33                         <version>1.0.0</version>
     33                        <version>1.1.0</version>
    3434                </dependency>
    3535
     
    3737                        <groupId>geniusweb</groupId>
    3838                        <artifactId>bidspace</artifactId>
    39                         <version>1.0.0</version>
     39                        <version>1.1.0</version>
    4040                </dependency>
    4141                <dependency>
    4242                        <groupId>geniusweb</groupId>
    4343                        <artifactId>profileconnection</artifactId>
    44                         <version>1.0.0</version>
     44                        <version>1.1.0</version>
    4545                </dependency>
    4646                <dependency>
  • exampleparties/randompartypy/src/main/resources/RandomParty.py

    r2 r9  
    2424import geniusweb.profile.Profile as Profile
    2525import geniusweb.profile.PartialOrdering as PartialOrdering
    26 import geniusweb.profile.utilityspace.LinearAdditiveUtilitySpace as LinearAdditiveUtilitySpace
     26import geniusweb.profile.utilityspace.UtilitySpace as UtilitySpace
    2727import geniusweb.references.ProfileRef as ProfileRef
    2828import geniusweb.references.ProtocolRef as ProtocolRef
     
    9797                        return false
    9898                profile = self.profile.getProfile()
    99                 if isinstance(profile, LinearAdditiveUtilitySpace):
     99                if isinstance(profile, UtilitySpace):
    100100                        return profile.getUtility(bid).doubleValue() > 0.6;
    101101                if isinstance(profile, PartialOrdering):
  • exampleparties/randompartypy/src/test/java/geniusweb/exampleparties/randompartypy/RandomPartyTest.java

    r8 r9  
    3131import geniusweb.actions.PartyId;
    3232import geniusweb.bidspace.AllBidsList;
    33 import geniusweb.connection.Connection;
     33import geniusweb.connection.ConnectionEnd;
    3434import geniusweb.issuevalue.Bid;
    3535import geniusweb.party.Capabilities;
     
    111111        public void testInformSettings() {
    112112                party.connect(connection);
    113                 connection.notifyChange(settings);
     113                connection.notifyListeners(settings);
    114114                assertEquals(0, connection.getActions().size());
    115115        }
     
    190190 */
    191191class TestConnection extends DefaultListenable<Inform>
    192                 implements Connection<Inform, Action> {
     192                implements ConnectionEnd<Inform, Action> {
    193193        private List<Action> actions = new LinkedList<>();
    194194
  • exampleparties/timedependentparty/pom.xml

    r8 r9  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>timedependentparty</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
     
    3333                        <groupId>geniusweb</groupId>
    3434                        <artifactId>party</artifactId>
    35                         <version>1.0.0</version>
     35                        <version>1.1.0</version>
    3636                </dependency>
    3737
     
    3939                        <groupId>geniusweb</groupId>
    4040                        <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>
    4247                </dependency>
    4348                <dependency>
    4449                        <groupId>tudelft.utilities</groupId>
    4550                        <artifactId>logging</artifactId>
    46                         <version>1.0.0</version>
    47                 </dependency>
    48                 <dependency>
    49                         <groupId>geniusweb</groupId>
    50                         <artifactId>profileconnection</artifactId>
    5151                        <version>1.0.0</version>
    5252                </dependency>
  • exampleparties/timedependentparty/src/test/java/geniusweb/exampleparties/timedependentparty/TimeDependentPartyTest.java

    r8 r9  
    3333import geniusweb.actions.PartyId;
    3434import geniusweb.bidspace.AllBidsList;
    35 import geniusweb.connection.Connection;
     35import geniusweb.connection.ConnectionEnd;
    3636import geniusweb.issuevalue.Bid;
    3737import geniusweb.party.Capabilities;
     
    118118        public void testInformSettings() {
    119119                party.connect(connection);
    120                 connection.notifyChange(settings);
     120                connection.notifyListeners(settings);
    121121                assertEquals(0, connection.getActions().size());
    122122        }
     
    223223 */
    224224class TestConnection extends DefaultListenable<Inform>
    225                 implements Connection<Inform, Action> {
     225                implements ConnectionEnd<Inform, Action> {
    226226        private List<Action> actions = new LinkedList<>();
    227227
  • issuevalue/pom.xml

    r6 r9  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>issuevalue</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
  • issuevalue/src/main/java/geniusweb/issuevalue/Bid.java

    r4 r9  
    9898        }
    9999
     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
    100108        @Override
    101109        public String toString() {
  • party/pom.xml

    r6 r9  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>party</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
     
    3131                        <groupId>geniusweb</groupId>
    3232                        <artifactId>timeline</artifactId>
    33                         <version>1.0.0</version>
     33                        <version>1.1.0</version>
    3434                </dependency>
    3535                <dependency>
    3636                        <groupId>geniusweb</groupId>
    3737                        <artifactId>profile</artifactId>
    38                         <version>1.0.0</version>
     38                        <version>1.1.0</version>
    3939                </dependency>
    4040                <dependency>
    4141                        <groupId>geniusweb</groupId>
    4242                        <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>
    4449                </dependency>
    4550                <dependency>
    4651                        <groupId>tudelft.utilities</groupId>
    4752                        <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>
    5454                </dependency>
    5555                <dependency>
  • party/src/main/java/geniusweb/party/DefaultParty.java

    r1 r9  
    22
    33import geniusweb.actions.Action;
    4 import geniusweb.connection.Connection;
     4import geniusweb.connection.ConnectionEnd;
    55import geniusweb.party.inform.Inform;
    66import tudelft.utilities.listener.Listener;
     
    1313 */
    1414public abstract class DefaultParty implements Party, Listener<Inform> {
    15         private Connection<Inform, Action> connection = null;
     15        private ConnectionEnd<Inform, Action> connection = null;
    1616        protected Reporter reporter;
    1717
     
    2525
    2626        @Override
    27         public void connect(Connection<Inform, Action> connection) {
     27        public void connect(ConnectionEnd<Inform, Action> connection) {
    2828                this.connection = connection;
    2929                connection.addListener(this);
     
    4747         *         connected.
    4848         */
    49         public Connection<Inform, Action> getConnection() {
     49        public ConnectionEnd<Inform, Action> getConnection() {
    5050                return connection;
    5151        }
  • pom.xml

    r8 r9  
    1313        <properties>
    1414                <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>
    1616        </properties>
    1717
  • profile/pom.xml

    r4 r9  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>profile</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
     
    3131                        <groupId>geniusweb</groupId>
    3232                        <artifactId>issuevalue</artifactId>
    33                         <version>1.0.0</version>
     33                        <version>1.1.0</version>
    3434                </dependency>
    3535                <dependency>
    3636                        <groupId>geniusweb</groupId>
    3737                        <artifactId>references</artifactId>
    38                         <version>1.0.0</version>
     38                        <version>1.1.0</version>
    3939                </dependency>
    4040
  • profile/src/main/java/geniusweb/profile/Profile.java

    r2 r9  
    77import geniusweb.issuevalue.Domain;
    88import geniusweb.profile.utilityspace.LinearAdditiveUtilitySpace;
     9import geniusweb.profile.utilityspace.SumOfGroupsUtilitySpace;
    910
    1011/**
     
    1718@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
    1819@JsonSubTypes({ @JsonSubTypes.Type(value = LinearAdditiveUtilitySpace.class),
    19                 @JsonSubTypes.Type(value = DefaultPartialOrdering.class) })
     20                @JsonSubTypes.Type(value = DefaultPartialOrdering.class),
     21                @JsonSubTypes.Type(value = SumOfGroupsUtilitySpace.class) })
    2022public interface Profile {
    2123
     
    3335        /**
    3436         *
    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
    3942         *         "reservation value" and is more general. If null, there is no
    4043         *         reservation bid and any agreement is better than no agreement.
  • profile/src/main/java/geniusweb/profile/utilityspace/DiscreteValueSetUtilities.java

    r1 r9  
    88import com.fasterxml.jackson.annotation.JsonAutoDetect;
    99import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
     10import com.fasterxml.jackson.annotation.JsonTypeName;
    1011
    1112import geniusweb.issuevalue.DiscreteValue;
     
    1314import geniusweb.issuevalue.Value;
    1415import geniusweb.issuevalue.ValueSet;
    15 
    16 import com.fasterxml.jackson.annotation.JsonTypeName;
    1716
    1817/**
     
    3736         * create new object based on the given mapping from values to utilities.
    3837         *
    39          * @param valueUtils map with key {@link DiscreteValue}s and value a Double in
    40          *                   the range [0,1].
     38         * @param valueUtils map with key {@link DiscreteValue}s and value a Double
     39         *                   in the range [0,1].
    4140         * @throws NullPointerException     if one of the args is null
    4241         * @throws IllegalArgumentException if values are not in range [0,1].
    4342         */
    44         public DiscreteValueSetUtilities(Map<DiscreteValue, BigDecimal> valueUtils) {
     43        public DiscreteValueSetUtilities(
     44                        Map<DiscreteValue, BigDecimal> valueUtils) {
    4545                if (valueUtils == null) {
    4646                        throw new NullPointerException("valueUtils==null");
    4747                }
    4848                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");
    5051                }
    5152                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]");
    5457                }
    5558                this.valueUtilities.putAll(valueUtils);
     
    6871        public String isFitting(ValueSet valueset) {
    6972                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;
    7175                }
    7276                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 "
    7581                                        + valueUtilities.keySet();
    7682                return null;
     
    7985        @Override
    8086        public String toString() {
    81                 return "ValueSetUtilities" + valueUtilities;
     87                return "DiscreteValueSetUtilities" + valueUtilities;
    8288        }
    8389
     
    8692                final int prime = 31;
    8793                int result = 1;
    88                 result = prime * result + ((valueUtilities == null) ? 0 : valueUtilities.hashCode());
     94                result = prime * result
     95                                + ((valueUtilities == null) ? 0 : valueUtilities.hashCode());
    8996                return result;
    9097        }
  • profile/src/main/java/geniusweb/profile/utilityspace/NumberValueSetUtilities.java

    r4 r9  
    139139        @Override
    140140        public String toString() {
    141                 return "NumberValUtility(" + lowValue + "->" + lowUtility + ","
     141                return "NumberValueSetUtilities(" + lowValue + "->" + lowUtility + ","
    142142                                + highValue + "->" + highUtility + ")";
    143143        }
  • profile/src/test/java/geniusweb/profile/utilityspace/DiscreteValueSetUtilitiesTest.java

    r7 r9  
    33import static org.junit.Assert.assertEquals;
    44import static org.junit.Assert.assertFalse;
     5import static org.junit.Assert.assertTrue;
    56
    67import java.io.IOException;
     
    8182        @Override
    8283        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\\}");
    8788        }
    8889
     
    200201
    201202        }
     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
    202217}
  • profile/src/test/java/geniusweb/profile/utilityspace/LinearAdditiveTest.java

    r7 r9  
    2020
    2121import com.fasterxml.jackson.databind.ObjectMapper;
    22 import com.fasterxml.jackson.databind.exc.InvalidDefinitionException;
    2322
    2423import geniusweb.issuevalue.Bid;
     
    145144        public List<String> getGeneralTestStrings() {
    146145                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\"\\}\\]");
    151150        }
    152151
     
    271270        }
    272271
    273         @Test(expected = InvalidDefinitionException.class)
     272        @Test
    274273        public void loadFullWithJson() throws IOException {
    275274                String profile = new String(
  • profile/src/test/java/geniusweb/profile/utilityspace/NumberValueSetUtilTest.java

    r3 r9  
    4444        @Override
    4545        public List<String> getGeneralTestStrings() {
    46                 return Arrays.asList("NumberValUtility\\(12.5->0.5,18.5->0.9\\)",
    47                                 "NumberValUtility\\(12.5->0.6,18.5->0.9\\)",
    48                                 "NumberValUtility\\(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\\)");
    4949        }
    5050
  • profile/src/test/resources/party1.json

    r7 r9  
    9292                                "Location": {
    9393                                        "values": [
    94                                                 "Party Tent'",
     94                                                "Party Tent",
    9595                                                "Your Dorm",
    9696                                                "Party Room",
  • profileconnection/pom.xml

    r6 r9  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>profileconnection</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
     
    3131                        <groupId>geniusweb</groupId>
    3232                        <artifactId>profile</artifactId>
    33                         <version>1.0.0</version>
     33                        <version>1.1.0</version>
    3434                </dependency>
    3535
  • profileconnection/src/main/java/geniusweb/profileconnection/FileProfileConnector.java

    r2 r9  
    1010
    1111import geniusweb.profile.Profile;
     12import tudelft.utilities.listener.DefaultListenable;
    1213
    1314/**
    1415 * ProfileInterface based on a plain filesystem UTF8 file.
    1516 */
    16 public class FileProfileConnector implements ProfileInterface {
     17public class FileProfileConnector extends DefaultListenable<Profile>
     18                implements ProfileInterface {
    1719        private final static ObjectMapper jackson = new ObjectMapper();
    1820        private final Profile profile;
     
    2527        public FileProfileConnector(String filename) throws IOException {
    2628                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);
    2831                profile = jackson.readValue(serialized, Profile.class);
    2932        }
  • profileconnection/src/main/java/geniusweb/profileconnection/ProfileInterface.java

    r1 r9  
    22
    33import geniusweb.profile.Profile;
     4import tudelft.utilities.listener.Listenable;
    45
    56/**
    67 * A container holding a modifyable profile. This interface allows testing.
    78 */
    8 public interface ProfileInterface {
     9public interface ProfileInterface extends Listenable<Profile> {
    910
    1011        /**
  • profileconnection/src/main/java/geniusweb/profileconnection/WebsocketProfileConnector.java

    r1 r9  
    1515
    1616import geniusweb.profile.Profile;
     17import tudelft.utilities.listener.DefaultListenable;
    1718import tudelft.utilities.logging.Reporter;
    1819
     
    2122 */
    2223@ClientEndpoint
    23 public class WebsocketProfileConnector implements ProfileInterface {
     24public class WebsocketProfileConnector extends DefaultListenable<Profile>
     25                implements ProfileInterface {
    2426        private final static ObjectMapper jackson = new ObjectMapper();
    2527        private static final int TIMEOUT_MS = 2000;
     
    5658                // this will be called every time the profile changes.
    5759                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);
    5962        }
    6063
  • protocol/pom.xml

    r6 r9  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>protocol</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
     
    3131                        <groupId>geniusweb</groupId>
    3232                        <artifactId>profile</artifactId>
    33                         <version>1.0.0</version>
     33                        <version>1.1.0</version>
    3434                </dependency>
    3535                <dependency>
    3636                        <groupId>geniusweb</groupId>
    3737                        <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>
    4439                </dependency>
    4540                <dependency>
    4641                        <groupId>geniusweb</groupId>
    4742                        <artifactId>references</artifactId>
    48                         <version>1.0.0</version>
     43                        <version>1.1.0</version>
    4944                </dependency>
    5045                <dependency>
    5146                        <groupId>geniusweb</groupId>
    5247                        <artifactId>events</artifactId>
    53                         <version>1.0.0</version>
     48                        <version>1.1.0</version>
    5449                </dependency>
    5550                <dependency>
     
    6257                        <artifactId>logging</artifactId>
    6358                        <version>1.0.0</version>
     59                </dependency>
     60                <dependency>
     61                        <groupId>tudelft.utilities</groupId>
     62                        <artifactId>listener</artifactId>
     63                        <version>1.1.0</version>
    6464                </dependency>
    6565
     
    160160                                </configuration>
    161161                        </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>
    163180                        <plugin>
    164181                                <groupId>org.apache.maven.plugins</groupId>
  • protocol/src/main/java/geniusweb/protocol/NegoProtocol.java

    r1 r9  
    1010import geniusweb.events.CurrentState;
    1111import geniusweb.events.ProtocolEvent;
    12 import geniusweb.protocol.partyconnection.ConnectionWithPartyFactory;
     12import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
    1313import geniusweb.protocol.session.SessionProtocol;
    1414import geniusweb.protocol.session.SessionSettings;
     
    7070         *
    7171         *
    72          * @param connectionfactory the {@link ConnectionWithPartyFactory} that allows
     72         * @param connectionfactory the {@link ProtocolToPartyConnFactory} that allows
    7373         *                          the protocol to connect with the {@link Reference}s
    7474         *                          in the settings
    7575         */
    76         void start(ConnectionWithPartyFactory connectionfactory);
     76        void start(ProtocolToPartyConnFactory connectionfactory);
    7777
    7878        /**
  • protocol/src/main/java/geniusweb/protocol/session/DefaultSessionState.java

    r1 r9  
    1010import geniusweb.progress.Progress;
    1111import geniusweb.protocol.ProtocolException;
    12 import geniusweb.protocol.partyconnection.ConnectionWithParties;
     12import geniusweb.protocol.partyconnection.ProtocolToPartyConnections;
    1313import geniusweb.references.PartyWithProfile;
    1414
     
    1919        private final List<Action> actions;
    2020
    21         private final transient ConnectionWithParties connections;
     21        private final transient ProtocolToPartyConnections connections;
    2222
    2323        private final Progress progress;
     
    6060         */
    6161        public DefaultSessionState(List<Action> actions,
    62                         ConnectionWithParties conns, Progress progr,
     62                        ProtocolToPartyConnections conns, Progress progr,
    6363                        SessionSettings settings,
    6464                        Map<PartyId, PartyWithProfile> partyprofiles, ProtocolException e) {
     
    6767                }
    6868                if (conns == null) {
    69                         this.connections = new ConnectionWithParties(
     69                        this.connections = new ProtocolToPartyConnections(
    7070                                        Collections.EMPTY_LIST);
    7171                } else {
     
    9292         * @return existing connections.
    9393         */
    94         public ConnectionWithParties getConnections() {
     94        public ProtocolToPartyConnections getConnections() {
    9595                return connections;
    9696        }
  • protocol/src/main/java/geniusweb/protocol/session/saop/SAOP.java

    r8 r9  
    2323import geniusweb.protocol.CurrentNegoState;
    2424import geniusweb.protocol.ProtocolException;
    25 import geniusweb.protocol.partyconnection.ConnectionWithParty;
    26 import geniusweb.protocol.partyconnection.ConnectionWithPartyFactory;
     25import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
     26import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
    2727import geniusweb.protocol.session.SessionProtocol;
    2828import geniusweb.protocol.session.SessionSettings;
     
    9595        @Override
    9696        public synchronized void start(
    97                         ConnectionWithPartyFactory connectionfactory) {
     97                        ProtocolToPartyConnFactory connectionfactory) {
    9898
    9999                try {
     
    151151         */
    152152        protected synchronized void connect(
    153                         ConnectionWithPartyFactory connectionfactory)
     153                        ProtocolToPartyConnFactory connectionfactory)
    154154                        throws InterruptedException, IOException {
    155155                List<PartyWithProfile> participants = state.getSettings()
     
    158158                                .map(parti -> (parti.getParty().getPartyRef()))
    159159                                .collect(Collectors.toList());
    160                 List<ConnectionWithParty> connections = null;
     160                List<ProtocolToPartyConn> connections = null;
    161161                log.log(Level.INFO, "SAOP connect " + parties);
    162162                while (connections == null) {
     
    218218         */
    219219        protected synchronized void setupParties() throws ProtocolException {
    220                 for (ConnectionWithParty conn : state.getConnections()) {
     220                for (ProtocolToPartyConn conn : state.getConnections()) {
    221221                        conn.addListener(action -> actionRequest(conn, action));
    222222                }
    223223
    224                 for (ConnectionWithParty connection : state.getConnections()) {
     224                for (ProtocolToPartyConn connection : state.getConnections()) {
    225225                        try {
    226226                                sendSettings(connection);
     
    239239         * @throws IOException if party got disconnected
    240240         */
    241         private synchronized void sendSettings(ConnectionWithParty connection)
     241        private synchronized void sendSettings(ProtocolToPartyConn connection)
    242242                        throws IOException {
    243243                PartyId partyid = connection.getParty();
     
    261261         */
    262262        protected synchronized void actionRequest(
    263                         final ConnectionWithParty partyconn, final Action action) {
     263                        final ProtocolToPartyConn partyconn, final Action action) {
    264264                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);
    268272                        return;
    269273                }
     
    348352                        return;
    349353                Inform finished = new Finished(state.getAgreement());
    350                 for (ConnectionWithParty conn : state.getConnections()) {
     354                for (ProtocolToPartyConn conn : state.getConnections()) {
    351355                        sendFinish(conn, finished);
    352356                }
    353                 notifyChange(new CurrentNegoState(state));
    354         }
    355 
    356         private void sendFinish(ConnectionWithParty connection, Inform finished) {
     357                notifyListeners(new CurrentNegoState(state));
     358        }
     359
     360        private void sendFinish(ProtocolToPartyConn connection, Inform finished) {
    357361                try {
    358362                        connection.send(finished);
  • protocol/src/main/java/geniusweb/protocol/session/saop/SAOPState.java

    r4 r9  
    1616import geniusweb.progress.ProgressRounds;
    1717import geniusweb.protocol.ProtocolException;
    18 import geniusweb.protocol.partyconnection.ConnectionWithParties;
    19 import geniusweb.protocol.partyconnection.ConnectionWithParty;
     18import geniusweb.protocol.partyconnection.ProtocolToPartyConnections;
     19import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
    2020import geniusweb.protocol.session.DefaultSessionState;
    2121import geniusweb.protocol.session.SessionSettings;
     
    4242         *                      occurred.
    4343         */
    44         public SAOPState(List<Action> actions, ConnectionWithParties conns,
     44        public SAOPState(List<Action> actions, ProtocolToPartyConnections conns,
    4545                        Progress progress, SessionSettings settings,
    4646                        Map<PartyId, PartyWithProfile> partyprofiles, ProtocolException e) {
     
    5555        public SAOPState(SAOPSettings settings) {
    5656                this(Collections.emptyList(),
    57                                 new ConnectionWithParties(Collections.emptyList()), null,
     57                                new ProtocolToPartyConnections(Collections.emptyList()), null,
    5858                                settings, null, null);
    5959
     
    8282        /**
    8383         *
    84          * @param connection   the new {@link ConnectionWithParty}
     84         * @param connection   the new {@link ProtocolToPartyConn}
    8585         * @param partyprofile the {@link PartyWithProfile} that is associated with
    8686         *                     this state
     
    9191         *         state currently indicate if that already happened or not.
    9292         */
    93         public SAOPState with(ConnectionWithParty connection,
     93        public SAOPState with(ProtocolToPartyConn connection,
    9494                        PartyWithProfile partyprofile) {
    9595                // Only called from the SAOP initialization phase.
    96                 ConnectionWithParties newconns = getConnections().with(connection);
     96                ProtocolToPartyConnections newconns = getConnections().with(connection);
    9797                Map<PartyId, PartyWithProfile> newprofiles = new HashMap<>(
    9898                                getPartyProfiles());
  • protocol/src/main/java/geniusweb/protocol/tournament/allpermutations/AllPermutationsProtocol.java

    r1 r9  
    77import geniusweb.protocol.CurrentNegoState;
    88import geniusweb.protocol.SessionResult;
    9 import geniusweb.protocol.partyconnection.ConnectionWithPartyFactory;
     9import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
    1010import geniusweb.protocol.session.SessionProtocol;
    1111import geniusweb.protocol.session.SessionSettings;
     
    2929        private final transient Reporter log;
    3030
    31         private ConnectionWithPartyFactory connectionFactory; // FINAL
     31        private ProtocolToPartyConnFactory connectionFactory; // FINAL
    3232        private AllPermutationsState state; // MUTABLE
    3333
     
    4545
    4646        @Override
    47         public void start(ConnectionWithPartyFactory connectionfactory) {
     47        public void start(ProtocolToPartyConnFactory connectionfactory) {
    4848                this.connectionFactory = connectionfactory;
    49                 notifyChange(new TournamentStarted(state.getSize().longValue()));
     49                notifyListeners(new TournamentStarted(state.getSize().longValue()));
    5050                startNextSession();
    5151        }
     
    8585                                                sessionstate.getAgreement(), sessionstate.getError());
    8686                                state = state.with(result);
    87                                 notifyChange(new CurrentNegoState(state));
     87                                notifyListeners(new CurrentNegoState(state));
    8888                                if (!state.isFinal(now)) {
    8989                                        startNextSession();
  • protocol/src/test/java/geniusweb/protocol/session/ConnectionWithPartiesTest.java

    r1 r9  
    1414
    1515import geniusweb.actions.PartyId;
    16 import geniusweb.protocol.partyconnection.ConnectionWithParties;
    17 import geniusweb.protocol.partyconnection.ConnectionWithParty;
     16import geniusweb.protocol.partyconnection.ProtocolToPartyConnections;
     17import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
    1818import tudelft.utilities.junit.GeneralTests;
    1919
    2020public class ConnectionWithPartiesTest
    21                 extends GeneralTests<ConnectionWithParties> {
     21                extends GeneralTests<ProtocolToPartyConnections> {
    2222        PartyId party1 = new PartyId("party1");
    2323        PartyId party2 = new PartyId("party2");
    2424        PartyId party3 = new PartyId("party3");
    2525
    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);
    2929
    30         private ConnectionWithParties conns1 = new ConnectionWithParties(
     30        private ProtocolToPartyConnections conns1 = new ProtocolToPartyConnections(
    3131                        Arrays.asList(con1, con2));
    32         private ConnectionWithParties conns1a = new ConnectionWithParties(
     32        private ProtocolToPartyConnections conns1a = new ProtocolToPartyConnections(
    3333                        Arrays.asList(con1, con2));
    34         private ConnectionWithParties conns2 = new ConnectionWithParties(
     34        private ProtocolToPartyConnections conns2 = new ProtocolToPartyConnections(
    3535                        Arrays.asList(con1, con3));
    36         private ConnectionWithParties conns3 = new ConnectionWithParties(
     36        private ProtocolToPartyConnections conns3 = new ProtocolToPartyConnections(
    3737                        Arrays.asList(con2, con1));
    38         private ConnectionWithParties conns4 = new ConnectionWithParties(
     38        private ProtocolToPartyConnections conns4 = new ProtocolToPartyConnections(
    3939                        Arrays.asList(con2, con1, con3));
    40         private ConnectionWithParties conns5 = new ConnectionWithParties(
     40        private ProtocolToPartyConnections conns5 = new ProtocolToPartyConnections(
    4141                        Arrays.asList(con2, con1, con3, con1));
    4242
     
    5454
    5555        @Override
    56         public List<List<ConnectionWithParties>> getGeneralTestData() {
     56        public List<List<ProtocolToPartyConnections>> getGeneralTestData() {
    5757                return Arrays.asList(Arrays.asList(conns1, conns1a),
    5858                                Arrays.asList(conns2), Arrays.asList(conns3),
     
    9898        @Test
    9999        public void withPartyTest() {
    100                 ConnectionWithParties conns = conns3.with(con3);
     100                ProtocolToPartyConnections conns = conns3.with(con3);
    101101                assertEquals(2, conns3.size());
    102102                assertEquals(3, conns.size());
  • protocol/src/test/java/geniusweb/protocol/session/DefaultSessionStateTest.java

    r8 r9  
    2727import geniusweb.progress.ProgressTime;
    2828import geniusweb.protocol.ProtocolException;
    29 import geniusweb.protocol.partyconnection.ConnectionWithParties;
     29import geniusweb.protocol.partyconnection.ProtocolToPartyConnections;
    3030import geniusweb.protocol.session.saop.SAOPSettings;
    3131import geniusweb.references.Parameters;
     
    4848                PartyId party1 = new PartyId("party1");
    4949                actions.add(new EndNegotiation(party1));
    50                 ConnectionWithParties conns = new ConnectionWithParties(
     50                ProtocolToPartyConnections conns = new ProtocolToPartyConnections(
    5151                                Collections.EMPTY_LIST);
    5252                DeadlineTime deadline = new DeadlineTime(1000);
     
    126126
    127127        public DefaultSessionState1(List<Action> actions,
    128                         ConnectionWithParties conns, Progress progr,
     128                        ProtocolToPartyConnections conns, Progress progr,
    129129                        SessionSettings settings,
    130130                        Map<PartyId, PartyWithProfile> partyprofiles, ProtocolException e) {
  • protocol/src/test/java/geniusweb/protocol/session/saop/SAOPStateTest.java

    r4 r9  
    2727import geniusweb.progress.ProgressTime;
    2828import geniusweb.protocol.ProtocolException;
    29 import geniusweb.protocol.partyconnection.ConnectionWithParties;
    30 import geniusweb.protocol.partyconnection.ConnectionWithParty;
     29import geniusweb.protocol.partyconnection.ProtocolToPartyConnections;
     30import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
    3131import geniusweb.protocol.session.SessionSettings;
    3232import tudelft.utilities.junit.GeneralTests;
     
    4242        private List<Action> actions2 = Arrays.asList(action);
    4343
    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(
    4949                        Arrays.asList(party1conn, party2conn));
    50         private ConnectionWithParties connections2 = new ConnectionWithParties(
     50        private ProtocolToPartyConnections connections2 = new ProtocolToPartyConnections(
    5151                        Arrays.asList(party1conn, party3conn));
    52         private ConnectionWithParties connections3 = new ConnectionWithParties(
     52        private ProtocolToPartyConnections connections3 = new ProtocolToPartyConnections(
    5353                        Arrays.asList(party1conn, party2conn, party3conn));
    5454
     
    114114        @Test
    115115        public void constructWith0Connection() {
    116                 new SAOPState(actions, new ConnectionWithParties(Arrays.asList()),
     116                new SAOPState(actions, new ProtocolToPartyConnections(Arrays.asList()),
    117117                                progresstime, settings, null, null);
    118118        }
     
    132132        @Test
    133133        public void testNextActor2() {
    134                 ConnectionWithParties conns = new ConnectionWithParties(
     134                ProtocolToPartyConnections conns = new ProtocolToPartyConnections(
    135135                                Arrays.asList(party2conn, party3conn));
    136136                SAOPState state = new SAOPState(actions, conns, progresstime, settings,
  • protocol/src/test/java/geniusweb/protocol/session/saop/SAOPTest.java

    r8 r9  
    3939import geniusweb.progress.Progress;
    4040import geniusweb.protocol.ProtocolException;
    41 import geniusweb.protocol.partyconnection.ConnectionWithParties;
    42 import geniusweb.protocol.partyconnection.ConnectionWithParty;
    43 import geniusweb.protocol.partyconnection.ConnectionWithPartyFactory;
     41import geniusweb.protocol.partyconnection.ProtocolToPartyConnections;
     42import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
     43import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
    4444import geniusweb.references.Parameters;
    4545import geniusweb.references.PartyRef;
     
    7676        private final PartyWithProfile party2 = mock(PartyWithProfile.class);
    7777        private SAOP saop;
    78         private ConnectionWithPartyFactory factory;
     78        private ProtocolToPartyConnFactory factory;
    7979        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);
    8282        private Map<PartyId, PartyWithProfile> partyprofiles;
    8383        private Progress progress = mock(Progress.class);
    8484        private ProfileRef profile1;
    8585        private ProfileRef profile2;
    86         private ConnectionWithParties connectionswithparties = mock(
    87                         ConnectionWithParties.class);;
     86        private ProtocolToPartyConnections connectionswithparties = mock(
     87                        ProtocolToPartyConnections.class);;
    8888        @SuppressWarnings("unchecked")
    8989        private final Listener<ProtocolEvent> testlistener = mock(Listener.class);
     
    116116                when(settings.getDeadline()).thenReturn(deadlinetime);
    117117
    118                 factory = mock(ConnectionWithPartyFactory.class);
     118                factory = mock(ProtocolToPartyConnFactory.class);
    119119                connections = mock(List.class);
    120120                when(factory.connect(any(List.class))).thenReturn(connections);
     
    159159                when(state.getPartyProfiles()).thenReturn(partyprofiles);
    160160                when(state.getProgress()).thenReturn(progress);
    161                 when(state.with(any(ConnectionWithParty.class),
     161                when(state.with(any(ProtocolToPartyConn.class),
    162162                                any(PartyWithProfile.class))).thenReturn(connectedstate);
    163163                when(state.getNextActor()).thenReturn(PARTY1ID);
  • protocol/src/test/java/geniusweb/protocol/tournament/AllPermutationsProtocolTest.java

    r1 r9  
    2424import geniusweb.protocol.NegoState;
    2525import geniusweb.protocol.SessionResult;
    26 import geniusweb.protocol.partyconnection.ConnectionWithPartyFactory;
     26import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
    2727import geniusweb.protocol.session.SessionProtocol;
    2828import geniusweb.protocol.session.SessionSettings;
     
    4242        private final AllPermutationsProtocol app = new AllPermutationsProtocol(
    4343                        state, log);
    44         private final ConnectionWithPartyFactory factory = mock(
    45                         ConnectionWithPartyFactory.class);
     44        private final ProtocolToPartyConnFactory factory = mock(
     45                        ProtocolToPartyConnFactory.class);
    4646        private final SessionSettings settings = mock(SessionSettings.class);
    4747        private final SessionState finalsessionstate = mock(SessionState.class);
     
    140140
    141141        @Override
    142         public void start(ConnectionWithPartyFactory connectionfactory) {
     142        public void start(ProtocolToPartyConnFactory connectionfactory) {
    143143
    144144        }
  • pythonadapter/pom.xml

    r1 r9  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>pythonadapter</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
     
    3131                        <groupId>geniusweb</groupId>
    3232                        <artifactId>party</artifactId>
    33                         <version>1.0.0</version>
     33                        <version>1.1.0</version>
    3434                </dependency>
    3535
  • pythonadapter/src/main/java/geniusweb/pythonadapter/PythonPartyAdapter.java

    r1 r9  
    77
    88import geniusweb.actions.Action;
    9 import geniusweb.connection.Connection;
     9import geniusweb.connection.ConnectionEnd;
    1010import geniusweb.party.Capabilities;
    1111import geniusweb.party.DefaultParty;
     
    104104
    105105        @Override
    106         public void connect(Connection<Inform, Action> connection) {
     106        public void connect(ConnectionEnd<Inform, Action> connection) {
    107107                pyparty.connect(connection);
    108108        }
  • references/pom.xml

    r6 r9  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>references</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
     
    3131                        <groupId>tudelft.utilities</groupId>
    3232                        <artifactId>listener</artifactId>
    33                         <version>1.0.0</version>
     33                        <version>1.1.0</version>
    3434                </dependency>
    3535
  • references/src/main/java/geniusweb/connection/Connectable.java

    r1 r9  
    22
    33/**
    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.
    56 *
    6  * @param <INTYPE> the type of incoming messages
     7 * @param <INTYPE>  the type of incoming messages
    78 * @param <OUTTYPE> the type of outgoing messages
    89 */
     
    1314         * @param connection the new connection
    1415         */
    15         void connect(Connection<INTYPE, OUTTYPE> connection);
     16        void connect(ConnectionEnd<INTYPE, OUTTYPE> connection);
    1617
    1718        /**
  • references/src/main/java/geniusweb/connection/ConnectionFactory.java

    r1 r9  
    99 * factory that can turn a {@link Reference} into a connection to that
    1010 * reference.
     11 *
    1112 *
    1213 * @param <INTYPE>  the type of incoming messages. Incoming messages are
     
    3031         *                                 the server. This suggest to retry later.
    3132         */
    32         Connection<INTYPE, OUTTYPE> connect(Reference reference)
     33        ConnectionEnd<INTYPE, OUTTYPE> connect(Reference reference)
    3334                        throws IOException, NoResourcesNowException;
    3435
  • references/src/main/java/geniusweb/connection/DefaultConnection.java

    r1 r9  
    1414 */
    1515public abstract class DefaultConnection<INTYPE, OUTTYPE> extends
    16                 DefaultListenable<INTYPE> implements Connection<INTYPE, OUTTYPE> {
     16                DefaultListenable<INTYPE> implements ConnectionEnd<INTYPE, OUTTYPE> {
    1717}
  • simplerunner/pom.xml

    r6 r9  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>simplerunner</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1616                <basedir>.</basedir>
    1717                <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>
    1919        </properties>
    2020
     
    3131                        <groupId>geniusweb</groupId>
    3232                        <artifactId>protocol</artifactId>
    33                         <version>1.0.0</version>
     33                        <version>1.1.0</version>
    3434                </dependency>
    3535                <dependency>
    3636                        <groupId>geniusweb</groupId>
    3737                        <artifactId>party</artifactId>
    38                         <version>1.0.0</version>
     38                        <version>1.1.0</version>
    3939                </dependency>
    4040                <dependency>
    4141                        <groupId>geniusweb.exampleparties</groupId>
    4242                        <artifactId>randomparty</artifactId>
    43                         <version>1.0.0</version>
     43                        <version>1.1.0</version>
     44                        <scope>test</scope>
    4445                </dependency>
    4546
     
    9899                                </configuration>
    99100                        </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>
    101119                        <plugin>
    102120                                <groupId>org.apache.maven.plugins</groupId>
  • simplerunner/src/main/java/geniusweb/simplerunner/BasicConnection.java

    r1 r9  
    44import java.net.URI;
    55
    6 import geniusweb.connection.Connection;
     6import geniusweb.connection.ConnectionEnd;
    77import geniusweb.references.Reference;
    88import tudelft.utilities.listener.DefaultListenable;
     
    1717 */
    1818public class BasicConnection<IN, OUT> extends DefaultListenable<IN>
    19                 implements Connection<IN, OUT> {
     19                implements ConnectionEnd<IN, OUT> {
    2020        private final Reference reference;
    2121        private final URI uri;
  • simplerunner/src/main/java/geniusweb/simplerunner/ClassPathConnectionFactory.java

    r1 r9  
    1313import geniusweb.party.Party;
    1414import geniusweb.party.inform.Inform;
    15 import geniusweb.protocol.partyconnection.ConnectionWithParty;
    16 import geniusweb.protocol.partyconnection.ConnectionWithPartyFactory;
     15import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
     16import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
    1717import geniusweb.references.Reference;
    1818import tudelft.utilities.repository.NoResourcesNowException;
     
    2525 *
    2626 */
    27 public class ClassPathConnectionFactory implements ConnectionWithPartyFactory {
     27public class ClassPathConnectionFactory implements ProtocolToPartyConnFactory {
    2828        private static final String SCHEME = "classpath";
    2929        private static int serialcounter = 1;
     
    3131
    3232        @Override
    33         public ConnectionWithParty connect(Reference reference) {
     33        public ProtocolToPartyConn connect(Reference reference) {
    3434                // set up the whole other party including the connection to it.
    3535                String classpath = getClassPath(reference.getURI());
     
    4242                                uri("classpath:" + reference.getURI().getSchemeSpecificPart()
    4343                                                + "." + (serialcounter++)));
    44                 party2protocol.init(action -> protocol2party.notifyChange(action));
    45                 protocol2party.init(info -> party2protocol.notifyChange(info));
     44                party2protocol.init(action -> protocol2party.notifyListeners(action));
     45                protocol2party.init(info -> party2protocol.notifyListeners(info));
    4646
    4747                party.connect(party2protocol);
     
    102102
    103103        @Override
    104         public List<ConnectionWithParty> connect(List<Reference> references)
     104        public List<ProtocolToPartyConn> connect(List<Reference> references)
    105105                        throws IOException, NoResourcesNowException {
    106                 List<ConnectionWithParty> connections = new LinkedList<>();
     106                List<ProtocolToPartyConn> connections = new LinkedList<>();
    107107                for (Reference partyref : references) {
    108108                        connections.add(connect(partyref));
     
    114114
    115115class BasicConnectionWithParty extends BasicConnection<Action, Inform>
    116                 implements ConnectionWithParty {
     116                implements ProtocolToPartyConn {
    117117
    118118        private PartyId id;
  • simplerunner/src/main/java/geniusweb/simplerunner/NegoRunner.java

    r1 r9  
    1313import geniusweb.protocol.NegoProtocol;
    1414import geniusweb.protocol.NegoSettings;
    15 import geniusweb.protocol.partyconnection.ConnectionWithPartyFactory;
     15import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
    1616import geniusweb.protocol.session.SessionSettings;
    1717import tudelft.utilities.logging.ReportToLogger;
     
    2727        private final NegoSettings settings;
    2828        private final NegoProtocol protocol;
    29         private final ConnectionWithPartyFactory connectionfactory;
     29        private final ProtocolToPartyConnFactory connectionfactory;
    3030        private final Reporter log;
    3131        private final static ObjectMapper jackson = new ObjectMapper();
    3232
    3333        public NegoRunner(NegoSettings settings,
    34                         ConnectionWithPartyFactory connectionfactory, Reporter logger) {
     34                        ProtocolToPartyConnFactory connectionfactory, Reporter logger) {
    3535                if (settings == null || connectionfactory == null) {
    3636                        throw new NullPointerException("Arguments must be not null");
  • simplerunner/src/test/java/geniusweb/simplerunner/ClassPathConnectionFactoryTest.java

    r1 r9  
    1010
    1111import geniusweb.actions.Action;
    12 import geniusweb.connection.Connection;
     12import geniusweb.connection.ConnectionEnd;
    1313import geniusweb.party.inform.Inform;
    1414import geniusweb.references.PartyRef;
     
    4242        @Test
    4343        public void testRandomParty() throws IOException, URISyntaxException {
    44                 Connection<Action, Inform> party = factory.connect(new PartyRef(
     44                ConnectionEnd<Action, Inform> party = factory.connect(new PartyRef(
    4545                                "classpath:geniusweb.exampleparties.randomparty.RandomParty"));
    4646                assertNotNull(party);
  • simplerunner/src/test/java/geniusweb/simplerunner/SessionRunnerTest.java

    r1 r9  
    1818import geniusweb.protocol.CurrentNegoState;
    1919import geniusweb.protocol.ProtocolException;
    20 import geniusweb.protocol.partyconnection.ConnectionWithPartyFactory;
     20import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
    2121import geniusweb.protocol.session.SessionProtocol;
    2222import geniusweb.protocol.session.SessionSettings;
     
    4747        public void smokeTest() {
    4848                new NegoRunner(mock(SessionSettings.class),
    49                                 mock(ConnectionWithPartyFactory.class), logger);
     49                                mock(ProtocolToPartyConnFactory.class), logger);
    5050        }
    5151
     
    5656                when(settings.getProtocol(logger)).thenReturn(protocol);
    5757                @SuppressWarnings("unchecked")
    58                 ConnectionWithPartyFactory factory = mock(
    59                                 ConnectionWithPartyFactory.class);
     58                ProtocolToPartyConnFactory factory = mock(
     59                                ProtocolToPartyConnFactory.class);
    6060
    6161                NegoRunner runner = spy(
     
    8080                Reporter logger = mock(Reporter.class);
    8181                @SuppressWarnings("unchecked")
    82                 ConnectionWithPartyFactory factory = mock(
    83                                 ConnectionWithPartyFactory.class);
     82                ProtocolToPartyConnFactory factory = mock(
     83                                ProtocolToPartyConnFactory.class);
    8484                NegoRunner runner = spy(
    8585                                new NegoRunner(settings, factory, logger));
     
    107107                when(protocol.getState()).thenReturn(state);
    108108                @SuppressWarnings("unchecked")
    109                 ConnectionWithPartyFactory factory = mock(
    110                                 ConnectionWithPartyFactory.class);
     109                ProtocolToPartyConnFactory factory = mock(
     110                                ProtocolToPartyConnFactory.class);
    111111                NegoRunner runner = spy(
    112112                                new NegoRunner(settings, factory, logger));
  • timeline/pom.xml

    r6 r9  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>timeline</artifactId>
    8         <version>1.0.0</version>
     8        <version>1.1.0</version>
    99        <packaging>jar</packaging>
    1010
     
    1515                <basedir>.</basedir>
    1616                <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>
    1818        </properties>
    1919
Note: See TracChangeset for help on using the changeset viewer.