Changeset 24


Ignore:
Timestamp:
10/06/20 13:12:20 (4 years ago)
Author:
bart
Message:

Fixes an issue with processing maxPower of a vote. Javadoc maven plugin now uses latest version.

Files:
5 added
120 edited

Legend:

Unmodified
Added
Removed
  • bidspace/pom.xml

    r23 r24  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>bidspace</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1616                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1717                <jackson-2-version>2.9.10</jackson-2-version>
    18                 <geniusweb.version>1.5.2</geniusweb.version>
     18                <geniusweb.version>1.5.3</geniusweb.version>
    1919        </properties>
    2020
     
    159159                                <groupId>org.apache.maven.plugins</groupId>
    160160                                <artifactId>maven-javadoc-plugin</artifactId>
    161                                 <version>2.10.1</version>
     161                                <version>3.2.0</version>
    162162                                <executions>
    163163                                        <execution>
     
    166166                                                        <goal>jar</goal>
    167167                                                </goals>
    168                                                 <configuration>
    169                                                         <additionalparam>${javadoc.opts}</additionalparam>
    170                                                         <additionalparam>-Xdoclint:none</additionalparam>
    171                                                 </configuration>
    172168                                        </execution>
    173169                                </executions>
  • bidspace/src/main/java/geniusweb/bidspace/AllBidsList.java

    r1 r24  
    2626
    2727        /**
    28          * A list containing all bids in the space. This is an ImmutableList so it
    29          * can contain all bids without pre-computing them.
     28         * This object contains s list containing all bids in the space. This is an
     29         * ImmutableList so it can contain all bids without pre-computing them.
     30         *
     31         * @param domain the {@link Domain}
    3032         *
    3133         */
  • bidspace/src/main/java/geniusweb/bidspace/AllPartialBidsList.java

    r1 r24  
    3232         * pre-computing them.
    3333         *
     34         * @param domain the {@link Domain}
    3435         */
    3536        public AllPartialBidsList(Domain domain) {
  • bidspace/src/main/java/geniusweb/bidspace/BidsWithUtility.java

    r10 r24  
    4343         * Default constructor, uses default precision 6. This value seems practical
    4444         * for the common range of issues, utilities and weights. See
    45          * {@link #BidsWithUtil(LinearAdditive, int)} for more details on the
     45         * {@link #BidsWithUtility(LinearAdditive, int)} for more details on the
    4646         * precision.
    4747         *
     
    7373         *                  digits should be feasible; for 9 issues, 6 digits may be
    7474         *                  the maximum.
    75          *                  <p>
    76          *
    7775         */
    7876        public BidsWithUtility(LinearAdditive space, int precision) {
     
    138136         * utilities in given range.
    139137         *
    140          * @param n    the number of {@link #issueRanges} to consider, we consider
    141          *             0..n here. The recursion decreases n until n=0
     138         * @param n    the number of issueRanges to consider, we consider 0..n here.
     139         *             The recursion decreases n until n=0
    142140         * @param goal the minimum and maximum utility required of the bids. to be
    143141         *             included (both ends inclusive)
  • bidspace/src/main/java/geniusweb/bidspace/Interval.java

    r10 r24  
    1616
    1717        /**
    18          * AN interval [min,max]. If min>max, then there are no values in this
     18         * AN interval [min,max]. If min &gt; max, then there are no values in this
    1919         * interval.
    2020         *
    21          * @param min
    22          * @param max
     21         * @param min the minimum value of the interval
     22         * @param max the maximum value of the interval
    2323         */
    2424        public Interval(BigDecimal min, BigDecimal max) {
     
    4949         *
    5050         * @param value the value to test
    51          * @return true iff min<=value<=max
     51         * @return true iff min &le; value &le; max
    5252         */
    5353        public boolean contains(BigDecimal value) {
     
    6666        /**
    6767         *
    68          * @param minMax another minMax to intersect with
    69          * @return intersection with other. returns null if intersection is empty.
     68         * @param other another {@link Interval} intersect with
     69         * @return intersection of this with other. returns null if intersection is
     70         *         empty.
    7071         */
    7172        public Interval intersect(Interval other) {
  • bidspace/src/main/java/geniusweb/bidspace/IssueInfo.java

    r10 r24  
    2626        private final Map<Value, BigDecimal> weightedUtils;
    2727
     28        /**
     29         *
     30         * @param name      the issue name
     31         * @param values    the {@link ValueSet} of the issue
     32         * @param utils     the {@link ValueSetUtilities} of the issue profile
     33         * @param weight    the weight of the {@link ValueSetUtilities}
     34         * @param precision the precision to compute with. Basically the number of
     35         *                  decimal places used for the computations.
     36         *
     37         */
    2838        public IssueInfo(String name, ValueSet values, ValueSetUtilities utils,
    2939                        BigDecimal weight, int precision) {
     
    4555         *
    4656         * @return weighted minimum and maximum utility achievable with this issue,
    47          *         rounded to the {@link #precision}.
     57         *         rounded to the requested precision.
    4858         */
    4959        public Interval getInterval() {
     
    5363        /**
    5464         *
    55          * @param isMax
     65         * @param isMax if true the max {@link Value} is returned, else the min is
     66         *              returned.
    5667         * @return the extreme value, either the minimum if isMax=false or maximum
    5768         *         if isMax=true
     
    8697         * @param val the issue value to be evaluated
    8798         * @return weighted utility of given value, rounded to nearest value with
    88          *         {@link #precision} digits.
     99         *         the requested precision number of digits.
    89100         */
    90101        public BigDecimal getWeightedUtil(Value val) {
  • boa/pom.xml

    r23 r24  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>boa</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    146146                                <groupId>org.apache.maven.plugins</groupId>
    147147                                <artifactId>maven-javadoc-plugin</artifactId>
    148                                 <version>2.10.1</version>
     148                                <version>3.2.0</version>
    149149                                <executions>
    150150                                        <execution>
     
    153153                                                        <goal>jar</goal>
    154154                                                </goals>
    155                                                 <configuration>
    156                                                         <additionalparam>${javadoc.opts}</additionalparam>
    157                                                         <additionalparam>-Xdoclint:none</additionalparam>
    158                                                 </configuration>
    159155                                        </execution>
    160156                                </executions>
  • boa/src/main/java/geniusweb/boa/BoaState.java

    r21 r24  
    3838        /**
    3939         * Initial state. Update using with(settings).
     40         *
     41         * @param reporter the {@link Reporter} to use for logging
    4042         */
    4143        public BoaState(Reporter reporter) {
     
    8385         * This should be the first update call used.
    8486         *
    85          * @param settings    the negoi {@link Settings}
     87         * @param newsettings the negoi {@link Settings}
    8688         * @param bidstrat    the {@link BiddingStrategy}
    8789         * @param acceptstrat the {@link AcceptanceStrategy}
    8890         * @param omClass     the class of the {@link OpponentModel}
    89          * @param reporter    the {@link Reporter} that can be used to log messages
    9091         * @return initialized BoaState
    9192         */
     
    175176        /**
    176177         *
    177          * @param bid
     178         * @param bid the {@link Bid} to check
    178179         * @return true iff {@link #acceptanceStrategy} says the bid is acceptable
    179180         */
  • boa/src/main/java/geniusweb/boa/DefaultBoa.java

    r21 r24  
    106106         * @param settings the {@link Settings}
    107107         * @return the {@link OpponentModel} class to use for modeling opponents
     108         * @throws InstantiationFailedException if the requested opponent model can
     109         *                                      not be loaded
    108110         */
    109111        abstract protected Class<? extends OpponentModel> getOpponentModel(
     
    117119         * @return the {@link BiddingStrategy} to use for determining the next
    118120         *         {@link Action}
     121         * @throws InstantiationFailedException if the requested opponent model can
     122         *                                      not be loaded
    119123         */
    120124        abstract protected BiddingStrategy getBiddingStrategy(Settings settings)
     
    128132         * @return the {@link AcceptanceStrategy} to use for determining if a bid is
    129133         *         acceptable
     134         * @throws InstantiationFailedException if the requested opponent model can
     135         *                                      not be loaded
    130136         */
    131137        abstract protected AcceptanceStrategy getAccceptanceStrategy(
  • boa/src/main/java/geniusweb/boa/biddingstrategy/ExtendedUtilSpace.java

    r20 r24  
    9393
    9494        /**
    95          * @param utilityGoal
     95         * @param utilityGoal the intended utilty
    9696         * @return bids with utility inside [utilitygoal-tolerance, utilitygoal]
    9797         */
  • boa/src/main/java/geniusweb/boa/biddingstrategy/TimeDependentBiddingStrategy.java

    r21 r24  
    242242         * Overridable eg for tests
    243243         *
    244          * @param profile
     244         * @param profile a {@link LinearAdditive} profile
    245245         *
    246246         * @return {@link ExtendedUtilSpace}
  • collectparties.sh

    r23 r24  
    77rm -rf collectedparties
    88mkdir collectedparties
    9 VERSION=1.5.2
     9VERSION=1.5.3
    1010
    1111cp "exampleparties/anac2019/agentgg/target/agentgg-${VERSION}-jar-with-dependencies.jar" collectedparties
  • events/pom.xml

    r23 r24  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>events</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    157157                                <groupId>org.apache.maven.plugins</groupId>
    158158                                <artifactId>maven-javadoc-plugin</artifactId>
    159                                 <version>2.10.1</version>
     159                                <version>3.2.0</version>
    160160                                <executions>
    161161                                        <execution>
     
    164164                                                        <goal>jar</goal>
    165165                                                </goals>
    166                                                 <configuration>
    167                                                         <additionalparam>${javadoc.opts}</additionalparam>
    168                                                         <additionalparam>-Xdoclint:none</additionalparam>
    169                                                 </configuration>
    170166                                        </execution>
    171167                                </executions>
  • events/src/main/java/geniusweb/actions/Votes.java

    r21 r24  
    5757         * with power at most P.
    5858         *
    59          * @param otherVotes
     59         * @param otherVotes the {@link Votes}, usually from a previous round, that
     60         *                   this should extend.
    6061         * @return true iff this extends the otherVotes.
    6162         */
     
    6566                for (Vote vote : otherVotes.getVotes()) {
    6667                        Vote myvote = getVote(vote.getBid());
    67                         if (myvote == null)
    68                                 return false;
    69                         if (myvote.getMinPower() > vote.getMinPower())
     68                        if (myvote == null || myvote.getMinPower() > vote.getMinPower()
     69                                        || myvote.getMaxPower() < vote.getMaxPower())
    7070                                return false;
    7171                }
  • events/src/main/java/geniusweb/events/ActionEvent.java

    r1 r24  
    1818        /**
    1919         *
    20          * @param action
     20         * @param action the {@link Action} that was done
    2121         * @param time   the current time to use. see
    2222         *               {@link System#currentTimeMillis()}.
  • events/src/main/java/geniusweb/events/NegotiationEvent.java

    r1 r24  
    66import com.fasterxml.jackson.annotation.JsonTypeInfo;
    77import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
     8
     9import geniusweb.actions.Action;
    810
    911/**
  • events/src/main/java/geniusweb/inform/Agreements.java

    r21 r24  
    5151
    5252        /**
    53          * @param bid
    54          * @param parties
     53         * @param bid     a {@link Bid} to be added
     54         * @param parties {@link Set} of the {@link PartyId}s that accepted the bid
    5555         * @return new Agreements, with the new bid/parties added.
    5656         */
  • events/src/main/java/geniusweb/inform/Finished.java

    r21 r24  
    1515         * The session finished (can be for any reason).
    1616         *
    17          * @param agreedBid the bid that was finally agreed on; null if no
    18          *                  agreement.
     17         * @param agreements the {@link Agreements} that were finally agreed on.
    1918         */
    2019        @JsonCreator
    2120        public Finished(@JsonProperty("agreements") Agreements agreements) {
     21                if (agreements == null)
     22                        throw new NullPointerException("Agreements can't be null");
    2223                this.agreements = agreements;
    2324        }
  • events/src/main/java/geniusweb/inform/Inform.java

    r21 r24  
    77
    88/**
    9  * base class of all information sent to the {@link Party}
     9 * base class of all information sent to a Party
    1010 */
    1111@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
  • events/src/main/java/geniusweb/inform/Settings.java

    r21 r24  
    22
    33import java.util.HashMap;
     4import java.util.Map;
    45
    56import com.fasterxml.jackson.annotation.JsonCreator;
     
    1314
    1415/**
    15  * Informs a {@link Party} about all settings for the upcoming negotiation
    16  * session. This should be sent to a party one time, so that the party knows the
    17  * situation.
     16 * Informs a Party about all settings for the upcoming negotiation session. This
     17 * should be sent to a party one time, so that the party knows the situation.
    1818 *
    1919 */
     
    3131         * @param protocol   the protocol used in this session
    3232         * @param progress   the {@link Progress} object used for this session
    33          * @param parameters a Map<String, Object> containing initialization
    34          *                   parameters for this party. The Object can be a HashMap,
    35          *                   ArrayList, String, or number (Integer, Double, etc).
    36          *                   The Object should not be just any Object because
    37          *                   deserialization will work only with the mentioned
    38          *                   types.
     33         * @param parameters a {@link Map} &lt;String, Object&gt; containing
     34         *                   initialization parameters for this party. The Object
     35         *                   can be a HashMap, ArrayList, String, or number
     36         *                   (Integer, Double, etc). The Object should not be just
     37         *                   any Object because deserialization will work only with
     38         *                   the mentioned types.
    3939         */
    4040        @JsonCreator
     
    8585        /**
    8686         *
    87          * @return a HashMap<String,Object> containing initialization parameters
    88          *         that can be used by the party.
     87         * @return a {@link HashMap}&lt;String,Object&gt; containing initialization
     88         *         parameters that can be used by the party.
    8989         */
    9090        public HashMap<String, Object> getParameters() {
  • events/src/test/java/actions/VotesTest.java

    r22 r24  
    9494
    9595        @Test
    96         public void isExtendingTestLessPower() {
    97                 Vote powervoteA1 = new Vote(partyA, bid1, 3, 9);
    98                 Votes powerVotes = new Votes(partyA, Arrays.asList(powervoteA1));
    99                 assertFalse(powerVotes.isExtending(votes1));
    100                 assertTrue(votes1.isExtending(powerVotes));
     96        public void isExtendingIdenticalVotes() {
     97                assertTrue(votes1.isExtending(votes1));
     98        }
     99
     100        @Test
     101        public void isReallyExtendingVotesMin() {
     102                Vote powervoteA1 = new Vote(partyA, bid1, 1, 9);
     103                Votes powerVotes = new Votes(partyA,
     104                                Arrays.asList(powervoteA1, voteA2));
     105                assertTrue(powerVotes.isExtending(votes1));
     106        }
     107
     108        @Test
     109        public void isReallyExtendingVotesMax() {
     110                Vote powervoteA1 = new Vote(partyA, bid1, 2, 10);
     111                Votes powerVotes = new Votes(partyA,
     112                                Arrays.asList(powervoteA1, voteA2));
     113                assertTrue(powerVotes.isExtending(votes1));
     114        }
     115
     116        @Test
     117        public void IsNarrowingOneVoteRemoved() {
     118                Votes narrowVotes = new Votes(partyA, Arrays.asList(voteA2));
     119                assertFalse(narrowVotes.isExtending(votes1));
     120        }
     121
     122        @Test
     123        public void isNarrowingTestMoreMinPower() {
     124                Vote narrowVoteA1 = new Vote(partyA, bid1, 3, 9);
     125                Votes narrowVotes = new Votes(partyA,
     126                                Arrays.asList(narrowVoteA1, voteA2));
     127                assertFalse(narrowVotes.isExtending(votes1));
     128                assertTrue(votes1.isExtending(narrowVotes));
     129        }
     130
     131        @Test
     132        public void isNarrowingLessMaxPower() {
     133                Vote powervoteA1 = new Vote(partyA, bid1, 2, 8);
     134                Votes narrowVotes = new Votes(partyA,
     135                                Arrays.asList(powervoteA1, voteA2));
     136                assertFalse(narrowVotes.isExtending(votes1));
     137                assertTrue(votes1.isExtending(narrowVotes));
    101138        }
    102139
  • exampleparties/anac2019/agentgg/pom.xml

    r23 r24  
    66        <groupId>geniusweb.exampleparties.anac2019</groupId>
    77        <artifactId>agentgg</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.6</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    192192                                <groupId>org.apache.maven.plugins</groupId>
    193193                                <artifactId>maven-javadoc-plugin</artifactId>
    194                                 <version>2.10.1</version>
     194                                <version>3.2.0</version>
    195195                                <executions>
    196196                                        <execution>
     
    199199                                                        <goal>jar</goal>
    200200                                                </goals>
    201                                                 <configuration>
    202                                                         <additionalparam>${javadoc.opts}</additionalparam>
    203                                                         <additionalparam>-Xdoclint:none</additionalparam>
    204                                                 </configuration>
    205201                                        </execution>
    206202                                </executions>
  • exampleparties/anac2019/agentgg/src/main/java/geniusweb/exampleparties/agentgg/ImpMap.java

    r19 r24  
    6363         * "weight sum" and "number of times" in the import table.
    6464         *
    65          * @param bids a list of ordered bids, worst bid first, best bid last
     65         * @param bidOrdering a list of ordered bids, worst bid first, best bid last
    6666         */
    6767        public void self_update(List<Bid> bidOrdering) {
     
    116116         * @param bid the bid to get the importance (utility?) of.
    117117         * @return the importance value of bid. Note, this this returns possibly
    118          *         large (>1) values, as the importance is not normalized.
     118         *         large (&gt;1) values, as the importance is not normalized.
    119119         */
    120120        public double getImportance(Bid bid) {
  • exampleparties/anac2019/agentgg/src/main/java/geniusweb/exampleparties/agentgg/SimpleLinearOrdering.java

    r12 r24  
    6767        /**
    6868         *
    69          * @param bid
     69         * @param bid a {@link Bid}
    7070         * @return true iff bid is contained in this ordering
    7171         */
  • exampleparties/anac2019/agentgg/src/test/java/geniusweb/exampleparties/agentgg/AgentGGTest.java

    r21 r24  
    3535import geniusweb.connection.ConnectionEnd;
    3636import geniusweb.inform.ActionDone;
     37import geniusweb.inform.Agreements;
    3738import geniusweb.inform.Finished;
    3839import geniusweb.inform.Inform;
     
    180181                party.connect(connection);
    181182                party.notifyChange(settings);
    182                 party.notifyChange(new Finished(null));
     183
     184                Agreements agreements = mock(Agreements.class);
     185                when(agreements.toString()).thenReturn("agree");
     186                party.notifyChange(new Finished(agreements));
    183187
    184188                verify(reporter).log(eq(Level.INFO),
    185                                 eq("Final ourcome:Finished[null]"));
     189                                eq("Final ourcome:Finished[agree]"));
    186190        }
    187191
  • exampleparties/anac2019/winkyagent/pom.xml

    r23 r24  
    66        <groupId>geniusweb.exampleparties.anac2019</groupId>
    77        <artifactId>winkyagent</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.6</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    192192                                <groupId>org.apache.maven.plugins</groupId>
    193193                                <artifactId>maven-javadoc-plugin</artifactId>
    194                                 <version>2.10.1</version>
     194                                <version>3.2.0</version>
    195195                                <executions>
    196196                                        <execution>
     
    199199                                                        <goal>jar</goal>
    200200                                                </goals>
    201                                                 <configuration>
    202                                                         <additionalparam>${javadoc.opts}</additionalparam>
    203                                                         <additionalparam>-Xdoclint:none</additionalparam>
    204                                                 </configuration>
    205201                                        </execution>
    206202                                </executions>
  • exampleparties/anac2019/winkyagent/src/main/java/geniusweb/exampleparties/anac2019/winkyagent/SimpleLinearOrdering.java

    r12 r24  
    2929        /**
    3030         *
    31          * @param domain
     31         * @param domain the {@link Domain}
    3232         * @param bids   a list of bids, ordered from lowest to highest util. The
    3333         *               first bid will have utility 0, the last utility 1. If only
     
    6767        /**
    6868         *
    69          * @param bid
     69         * @param bid the {@link Bid}
    7070         * @return true iff bid is contained in this ordering
    7171         */
     
    8484        /**
    8585         *
    86          * @param profile
     86         * @param profile the {@link Profile}
    8787         * @return a list of bids in the profile sorted from low to high utility.
    8888         */
  • exampleparties/anac2019/winkyagent/src/test/java/geniusweb/exampleparties/anac2019/winkyagent/WinkyAgentTest.java

    r21 r24  
    3535import geniusweb.connection.ConnectionEnd;
    3636import geniusweb.inform.ActionDone;
     37import geniusweb.inform.Agreements;
    3738import geniusweb.inform.Finished;
    3839import geniusweb.inform.Inform;
     
    174175                party.connect(connection);
    175176                party.notifyChange(settings);
    176                 party.notifyChange(new Finished(null));
     177
     178                Agreements agreements = mock(Agreements.class);
     179                when(agreements.toString()).thenReturn("agree");
     180                party.notifyChange(new Finished(agreements));
    177181
    178182                verify(reporter).log(eq(Level.INFO),
    179                                 eq("Final ourcome:Finished[null]"));
     183                                eq("Final ourcome:Finished[agree]"));
    180184        }
    181185
  • exampleparties/boulware/pom.xml

    r23 r24  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>boulware</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    105105                                <groupId>org.apache.maven.plugins</groupId>
    106106                                <artifactId>maven-javadoc-plugin</artifactId>
    107                                 <version>2.10.1</version>
     107                                <version>3.2.0</version>
    108108                                <executions>
    109109                                        <execution>
     
    112112                                                        <goal>jar</goal>
    113113                                                </goals>
    114                                                 <configuration>
    115                                                         <additionalparam>${javadoc.opts}</additionalparam>
    116                                                         <additionalparam>-Xdoclint:none</additionalparam>
    117                                                 </configuration>
    118114                                        </execution>
    119115                                </executions>
  • exampleparties/comparebids/pom.xml

    r23 r24  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>comparebids</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.6</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    195195                                                        <goal>jar</goal>
    196196                                                </goals>
    197                                                 <configuration>
    198                                                         <additionalparam>${javadoc.opts}</additionalparam>
    199                                                         <additionalparam>-Xdoclint:none</additionalparam>
    200                                                 </configuration>
    201197                                        </execution>
    202198                                </executions>
  • exampleparties/conceder/pom.xml

    r23 r24  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>conceder</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    105105                                <groupId>org.apache.maven.plugins</groupId>
    106106                                <artifactId>maven-javadoc-plugin</artifactId>
    107                                 <version>2.10.1</version>
     107                                <version>3.2.0</version>
    108108                                <executions>
    109109                                        <execution>
     
    112112                                                        <goal>jar</goal>
    113113                                                </goals>
    114                                                 <configuration>
    115                                                         <additionalparam>${javadoc.opts}</additionalparam>
    116                                                         <additionalparam>-Xdoclint:none</additionalparam>
    117                                                 </configuration>
    118114                                        </execution>
    119115                                </executions>
  • exampleparties/hardliner/pom.xml

    r23 r24  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>hardliner</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    105105                                <groupId>org.apache.maven.plugins</groupId>
    106106                                <artifactId>maven-javadoc-plugin</artifactId>
    107                                 <version>2.10.1</version>
     107                                <version>3.2.0</version>
    108108                                <executions>
    109109                                        <execution>
     
    112112                                                        <goal>jar</goal>
    113113                                                </goals>
    114                                                 <configuration>
    115                                                         <additionalparam>${javadoc.opts}</additionalparam>
    116                                                         <additionalparam>-Xdoclint:none</additionalparam>
    117                                                 </configuration>
    118114                                        </execution>
    119115                                </executions>
  • exampleparties/humangui/pom.xml

    r23 r24  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>humangui</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.6</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    182182                                <groupId>org.apache.maven.plugins</groupId>
    183183                                <artifactId>maven-javadoc-plugin</artifactId>
    184                                 <version>2.10.1</version>
     184                                <version>3.2.0</version>
    185185                                <executions>
    186186                                        <execution>
     
    189189                                                        <goal>jar</goal>
    190190                                                </goals>
    191                                                 <configuration>
    192                                                         <additionalparam>${javadoc.opts}</additionalparam>
    193                                                         <additionalparam>-Xdoclint:none</additionalparam>
    194                                                 </configuration>
    195191                                        </execution>
    196192                                </executions>
  • exampleparties/humangui/src/main/java/geniusweb/exampleparties/humangui/BiddingInfo.java

    r21 r24  
    3232 * <li>{@link Bid} if user changed his prepared bid (but did not yet offer it)
    3333 * <li>{@link Profile} if the profile was changed
    34  * <li>{@Link Boolean} if the isMyTurn value changed.
     34 * <li>{@link Boolean} if the isMyTurn value changed.
    3535 * </ul>
    3636 */
     
    5757         * @param reporter   the {@link Reporter} where we can log issues.
    5858         * @param profileint the {@link ProfileInterface}
    59          * @throws Exception if we can not reach the protocol server
     59         * @throws IOException         if we can not reach the protocol server
     60         * @throws DeploymentException if we can not reach the protocol server
    6061         */
    6162        public BiddingInfo(Settings settings,
     
    9798         *
    9899         * @param action the action to execute.
    99          * @throws IOException           if action can not be sent.
    100          * @throws IllegalStateException if isMyTurn is false.
    101100         */
    102101        public void doAction(Action action) {
  • exampleparties/humangui/src/test/java/geniusweb/exampleparties/humangui/HumanGuiTest.java

    r21 r24  
    66import static org.junit.Assert.assertTrue;
    77import static org.mockito.Mockito.mock;
     8import static org.mockito.Mockito.when;
    89
    910import java.io.IOException;
     
    2829import geniusweb.bidspace.AllBidsList;
    2930import geniusweb.inform.ActionDone;
     31import geniusweb.inform.Agreements;
    3032import geniusweb.inform.Finished;
    3133import geniusweb.inform.Settings;
     
    7678        @After
    7779        public void after() {
    78                 party.notifyChange(new Finished(null));
     80                Agreements agreements = mock(Agreements.class);
     81                when(agreements.toString()).thenReturn("agree");
     82                party.notifyChange(new Finished(agreements));
    7983        }
    8084
  • exampleparties/linear/pom.xml

    r23 r24  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>linear</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    104104                                <groupId>org.apache.maven.plugins</groupId>
    105105                                <artifactId>maven-javadoc-plugin</artifactId>
    106                                 <version>2.10.1</version>
     106                                <version>3.2.0</version>
    107107                                <executions>
    108108                                        <execution>
     
    111111                                                        <goal>jar</goal>
    112112                                                </goals>
    113                                                 <configuration>
    114                                                         <additionalparam>${javadoc.opts}</additionalparam>
    115                                                         <additionalparam>-Xdoclint:none</additionalparam>
    116                                                 </configuration>
    117113                                        </execution>
    118114                                </executions>
  • exampleparties/randomparty/pom.xml

    r23 r24  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>randomparty</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.6</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    187187                                <groupId>org.apache.maven.plugins</groupId>
    188188                                <artifactId>maven-javadoc-plugin</artifactId>
    189                                 <version>2.10.1</version>
     189                                <version>3.2.0</version>
    190190                                <executions>
    191191                                        <execution>
     
    194194                                                        <goal>jar</goal>
    195195                                                </goals>
    196                                                 <configuration>
    197                                                         <additionalparam>${javadoc.opts}</additionalparam>
    198                                                         <additionalparam>-Xdoclint:none</additionalparam>
    199                                                 </configuration>
    200196                                        </execution>
    201197                                </executions>
  • exampleparties/randomparty/src/main/java/geniusweb/exampleparties/randomparty/RandomParty.java

    r22 r24  
    4040 * with sufficient utility.
    4141 * <h2>parameters</h2>
    42  * <table>
     42 * <table >
     43 * <caption>parameters</caption>
    4344 * <tr>
    4445 * <td>minPower</td>
  • exampleparties/randomparty/src/test/java/geniusweb/exampleparties/randomparty/RandomPartyTest.java

    r21 r24  
    88import static org.mockito.Mockito.mock;
    99import static org.mockito.Mockito.verify;
     10import static org.mockito.Mockito.when;
    1011
    1112import java.io.IOException;
     
    3839import geniusweb.connection.ConnectionEnd;
    3940import geniusweb.inform.ActionDone;
     41import geniusweb.inform.Agreements;
    4042import geniusweb.inform.Finished;
    4143import geniusweb.inform.Inform;
     
    163165                party.connect(connection);
    164166                party.notifyChange(settings);
    165                 party.notifyChange(new Finished(null));
     167                Agreements agreements = mock(Agreements.class);
     168                when(agreements.toString()).thenReturn("agree");
     169                party.notifyChange(new Finished(agreements));
    166170
    167171                verify(reporter).log(eq(Level.INFO),
    168                                 eq("Final ourcome:Finished[null]"));
     172                                eq("Final ourcome:Finished[agree]"));
    169173        }
    170174
  • exampleparties/randompartypy/pom.xml

    r23 r24  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>randompyparty</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    166166                                <groupId>org.apache.maven.plugins</groupId>
    167167                                <artifactId>maven-javadoc-plugin</artifactId>
    168                                 <version>2.10.1</version>
     168                                <version>3.2.0</version>
    169169                                <executions>
    170170                                        <execution>
     
    173173                                                        <goal>jar</goal>
    174174                                                </goals>
    175                                                 <configuration>
    176                                                         <additionalparam>${javadoc.opts}</additionalparam>
    177                                                         <additionalparam>-Xdoclint:none</additionalparam>
    178                                                 </configuration>
    179175                                        </execution>
    180176                                </executions>
  • exampleparties/simpleboa/pom.xml

    r23 r24  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>simpleboaparty</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.6</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    125125                                <groupId>org.apache.maven.plugins</groupId>
    126126                                <artifactId>maven-javadoc-plugin</artifactId>
    127                                 <version>2.10.1</version>
     127                                <version>3.2.0</version>
    128128                                <executions>
    129129                                        <execution>
     
    132132                                                        <goal>jar</goal>
    133133                                                </goals>
    134                                                 <configuration>
    135                                                         <additionalparam>${javadoc.opts}</additionalparam>
    136                                                         <additionalparam>-Xdoclint:none</additionalparam>
    137                                                 </configuration>
    138134                                        </execution>
    139135                                </executions>
  • exampleparties/simpleboa/src/test/java/geniusweb/exampleparties/simpleboa/SimpleBoaTest.java

    r21 r24  
    3737import geniusweb.connection.ConnectionEnd;
    3838import geniusweb.inform.ActionDone;
     39import geniusweb.inform.Agreements;
    3940import geniusweb.inform.Finished;
    4041import geniusweb.inform.Inform;
     
    164165                party.connect(connection);
    165166                party.notifyChange(settings);
    166                 party.notifyChange(new Finished(null));
     167
     168                Agreements agreements = mock(Agreements.class);
     169                when(agreements.toString()).thenReturn("agree");
     170                party.notifyChange(new Finished(agreements));
    167171
    168172                verify(reporter).log(eq(Level.INFO),
    169                                 eq("Final ourcome:Finished[null]"));
     173                                eq("Final ourcome:Finished[agree]"));
    170174        }
    171175
  • exampleparties/simpleshaop/pom.xml

    r23 r24  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>simpleshaop</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.6</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    188188                                <groupId>org.apache.maven.plugins</groupId>
    189189                                <artifactId>maven-javadoc-plugin</artifactId>
    190                                 <version>2.10.1</version>
     190                                <version>3.2.0</version>
    191191                                <executions>
    192192                                        <execution>
     
    195195                                                        <goal>jar</goal>
    196196                                                </goals>
    197                                                 <configuration>
    198                                                         <additionalparam>${javadoc.opts}</additionalparam>
    199                                                         <additionalparam>-Xdoclint:none</additionalparam>
    200                                                 </configuration>
    201197                                        </execution>
    202198                                </executions>
  • exampleparties/simpleshaop/src/main/java/geniusweb/exampleparties/simpleshaop/ShaopParty.java

    r21 r24  
    3838 * created.
    3939 * <p>
    40  * <b>Requirement<b> the initial {@link PartialOrdering} must contain at least
     40 * <b>Requirement</b> the initial {@link PartialOrdering} must contain at least
    4141 * the bids with lowest utility and highest utility, and the proper comparison
    4242 * info for these two bids.
  • exampleparties/simpleshaop/src/main/java/geniusweb/exampleparties/simpleshaop/SimpleLinearOrdering.java

    r11 r24  
    2121
    2222        private final Domain domain;
    23         private final List<Bid> bids; // worst bid first, best bid last.
     23        /**
     24         * List of bids. worst bid first, best bid last.
     25         */
     26        private final List<Bid> bids;
    2427
    2528        SimpleLinearOrdering(Profile profile) {
     
    2932        /**
    3033         *
    31          * @param domain
     34         * @param domain The {@link Domain}
    3235         * @param bids   a list of bids, ordered from lowest to highest util. The
    3336         *               first bid will have utility 0, the last utility 1. If only
     
    6770        /**
    6871         *
    69          * @param bid
     72         * @param bid the {@link Bid}
    7073         * @return true iff bid is contained in this ordering
    7174         */
     
    8487        /**
    8588         *
    86          * @param profile
     89         * @param profile the {@link Profile}
    8790         * @return a list of bids in the profile sorted from low to high utility.
    8891         */
     
    108111
    109112        /**
    110          * @param bid       a new bid to be inserted
     113         * @param bid       a new {@link Bid} to be inserted
    111114         * @param worseBids all bids that are worse than this bid.
    112          * @return a SimpleLinearOrdering, updated with the given comparison. Thee
    113          *         bid will be inserted after the first bid that is not worse than
    114          *         bid.
     115         * @return a {@link SimpleLinearOrdering}, updated with the given
     116         *         comparison. Thee bid will be inserted after the first bid that is
     117         *         not worse than bid.
    115118         */
    116119        public SimpleLinearOrdering with(Bid bid, List<Bid> worseBids) {
  • exampleparties/simpleshaop/src/test/java/geniusweb/exampleparties/simpleshaop/ShaopPartyTest.java

    r21 r24  
    88import static org.mockito.Mockito.mock;
    99import static org.mockito.Mockito.verify;
     10import static org.mockito.Mockito.when;
    1011
    1112import java.io.IOException;
     
    3738import geniusweb.connection.ConnectionEnd;
    3839import geniusweb.inform.ActionDone;
     40import geniusweb.inform.Agreements;
    3941import geniusweb.inform.Finished;
    4042import geniusweb.inform.Inform;
     
    178180                party.connect(connection);
    179181                party.notifyChange(settings);
    180                 party.notifyChange(new Finished(null));
     182
     183                Agreements agreements = mock(Agreements.class);
     184                when(agreements.toString()).thenReturn("agree");
     185                party.notifyChange(new Finished(agreements));
    181186
    182187                verify(reporter).log(eq(Level.INFO),
    183                                 eq("Final ourcome:Finished[null]"));
     188                                eq("Final ourcome:Finished[agree]"));
    184189        }
    185190
  • exampleparties/timedependentparty/pom.xml

    r23 r24  
    66        <groupId>geniusweb.exampleparties</groupId>
    77        <artifactId>timedependentparty</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    3434                        <groupId>geniusweb</groupId>
    3535                        <artifactId>party</artifactId>
    36         <version>${geniusweb.version}</version>
     36                        <version>${geniusweb.version}</version>
    3737                </dependency>
    3838
     
    4040                        <groupId>geniusweb</groupId>
    4141                        <artifactId>bidspace</artifactId>
    42         <version>${geniusweb.version}</version>
     42                        <version>${geniusweb.version}</version>
    4343                </dependency>
    4444                <dependency>
    4545                        <groupId>geniusweb</groupId>
    4646                        <artifactId>profileconnection</artifactId>
    47         <version>${geniusweb.version}</version>
     47                        <version>${geniusweb.version}</version>
    4848                </dependency>
    4949                <dependency>
     
    188188                                <groupId>org.apache.maven.plugins</groupId>
    189189                                <artifactId>maven-javadoc-plugin</artifactId>
    190                                 <version>2.10.1</version>
     190                                <version>3.2.0</version>
    191191                                <executions>
    192192                                        <execution>
     
    195195                                                        <goal>jar</goal>
    196196                                                </goals>
    197                                                 <configuration>
    198                                                         <additionalparam>${javadoc.opts}</additionalparam>
    199                                                         <additionalparam>-Xdoclint:none</additionalparam>
    200                                                 </configuration>
    201197                                        </execution>
    202198                                </executions>
  • exampleparties/timedependentparty/src/main/java/geniusweb/exampleparties/timedependentparty/ExtendedUtilSpace.java

    r10 r24  
    2121public class ExtendedUtilSpace {
    2222        private LinearAdditive utilspace;
    23         private BigDecimal tolerance; // utility tolerance for a bid.
     23        /**
     24         * The tolerance for a utility. Generally utilities can be this amount
     25         * smaller than requested. See also {@link #computeTolerance()}.
     26         */
     27        private BigDecimal tolerance;
    2428        private BidsWithUtility bidutils;
    2529        // min and max achievable utility
     
    9296
    9397        /**
    94          * @param utilityGoal
    95          * @return bids with utility inside [utilitygoal-tolerance, utilitygoal]
     98         * @param utilityGoal the requested utility
     99         * @return bids with utility inside [utilitygoal-{@link #tolerance},
     100         *         utilitygoal]
    96101         */
    97102        public ImmutableList<Bid> getBids(BigDecimal utilityGoal) {
  • exampleparties/timedependentparty/src/main/java/geniusweb/exampleparties/timedependentparty/TimeDependentParty.java

    r21 r24  
    3434 * brute-force search through the bidspace and can handle bidspace sizes up to
    3535 * 2^31 (approx 1 billion bids). It may take excessive time and run out of time
    36  * on bidspaces > 10000 bids. In special cases it may even run out of memory,
     36 * on bidspaces &gt; 10000 bids. In special cases it may even run out of memory,
    3737 */
    3838public class TimeDependentParty extends DefaultParty {
     
    104104         *         behaviour [1]:
    105105         *
    106          *         1. Boulware: For this strategy e < 1 and the initial offer is
     106         *         1. Boulware: For this strategy e &lt; 1 and the initial offer is
    107107         *         maintained till time is almost exhausted, when the agent concedes
    108108         *         up to its reservation value.
    109109         *
    110          *         2. Conceder: For this strategy e > 1 and the agent goes to its
     110         *         2. Conceder: For this strategy e &gt; 1 and the agent goes to its
    111111         *         reservation value very quickly.
    112112         *
  • exampleparties/timedependentparty/src/test/java/geniusweb/exampleparties/timedependentparty/TimeDependentPartyTest.java

    r21 r24  
    88import static org.mockito.Mockito.mock;
    99import static org.mockito.Mockito.verify;
     10import static org.mockito.Mockito.when;
    1011
    1112import java.io.IOException;
     
    3536import geniusweb.connection.ConnectionEnd;
    3637import geniusweb.inform.ActionDone;
     38import geniusweb.inform.Agreements;
    3739import geniusweb.inform.Finished;
    3840import geniusweb.inform.Inform;
     
    181183                party.connect(connection);
    182184                party.notifyChange(settings);
    183                 party.notifyChange(new Finished(null));
     185                Agreements agreements = mock(Agreements.class);
     186                when(agreements.toString()).thenReturn("agree");
     187
     188                party.notifyChange(new Finished(agreements));
    184189
    185190                verify(reporter).log(eq(Level.INFO),
    186                                 eq("Final ourcome:Finished[null]"));
     191                                eq("Final ourcome:Finished[agree]"));
    187192        }
    188193
  • issuevalue/pom.xml

    r23 r24  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>issuevalue</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    148148                                <groupId>org.apache.maven.plugins</groupId>
    149149                                <artifactId>maven-javadoc-plugin</artifactId>
    150                                 <version>2.10.1</version>
     150                                <version>3.2.0</version>
    151151                                <executions>
    152152                                        <execution>
     
    155155                                                        <goal>jar</goal>
    156156                                                </goals>
    157                                                 <configuration>
    158                                                         <additionalparam>${javadoc.opts}</additionalparam>
    159                                                         <additionalparam>-Xdoclint:none</additionalparam>
    160                                                 </configuration>
    161157                                        </execution>
    162158                                </executions>
  • issuevalue/src/main/java/geniusweb/issuevalue/Bid.java

    r9 r24  
    5656
    5757        /**
    58          * @param issue
     58         * @param issue name of the issue
    5959         * @return the value for the given issue, or null if there is no value for
    6060         *         the given issue.
     
    6565
    6666        /**
    67          *
    68          * @param issue
     67         * @param issue name of the issue
    6968         * @return true iff the bid contains a value for the given issue.
    7069         */
  • issuevalue/src/main/java/geniusweb/issuevalue/Domain.java

    r1 r24  
    7373        /**
    7474         *
    75          * @param domain the domain to check the bid in
     75         * @param bid a Bid
    7676         * @return null if this bid is complete, or an error message explaining why
    7777         *         the bid is not complete. Complete means that the bid contains a
  • issuevalue/src/main/java/geniusweb/issuevalue/ValueSet.java

    r1 r24  
    1717 * by a String)).
    1818 *
    19  * @param <T> type of objects in this value set. We do not implement ValueSet
    20  *        right away because types are lost at runtime. Implementing separate
    21  *        classes for implementing the ValueSet ensures we can get back the type
    22  *        at runtime. immutable. Thread safe.
     19 * Value is the type of objects in this value set. We do not implement ValueSet
     20 * right away because types are lost at runtime. Implementing separate classes
     21 * for implementing the ValueSet ensures we can get back the type at runtime.
     22 * immutable. Thread safe.
    2323 */
    2424@JsonDeserialize(using = ValueSetDeserializer.class)
     
    6262                        return codec.treeToValue(node, DiscreteValueSet.class);
    6363                }
    64                 throw new IllegalArgumentException("Expected 'range' or 'values' property for ValueSet contents");
     64                throw new IllegalArgumentException(
     65                                "Expected 'range' or 'values' property for ValueSet contents");
    6566        }
    6667
  • opponentmodel/pom.xml

    r23 r24  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>opponentmodel</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    167167                                <groupId>org.apache.maven.plugins</groupId>
    168168                                <artifactId>maven-javadoc-plugin</artifactId>
    169                                 <version>2.10.1</version>
     169                                <version>3.2.0</version>
    170170                                <executions>
    171171                                        <execution>
     
    174174                                                        <goal>jar</goal>
    175175                                                </goals>
    176                                                 <configuration>
    177                                                         <additionalparam>${javadoc.opts}</additionalparam>
    178                                                         <additionalparam>-Xdoclint:none</additionalparam>
    179                                                 </configuration>
    180176                                        </execution>
    181177                                </executions>
  • opponentmodel/src/main/java/geniusweb/opponentmodel/OpponentModel.java

    r20 r24  
    3737        /**
    3838         * Update this with a new action that was done by the opponent that this
    39          * model is modeling. {@link #with(Domain)} must be called before calling
    40          * this.
     39         * model is modeling. {@link #with(Domain, Bid)} must be called before
     40         * calling this.
    4141         *
    4242         * @param action   the new incoming action.
  • party/pom.xml

    r23 r24  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>party</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    173173                                <groupId>org.apache.maven.plugins</groupId>
    174174                                <artifactId>maven-javadoc-plugin</artifactId>
    175                                 <version>2.10.1</version>
     175                                <version>3.2.0</version>
    176176                                <executions>
    177177                                        <execution>
     
    180180                                                        <goal>jar</goal>
    181181                                                </goals>
    182                                                 <configuration>
    183                                                         <additionalparam>${javadoc.opts}</additionalparam>
    184                                                         <additionalparam>-Xdoclint:none</additionalparam>
    185                                                 </configuration>
    186182                                        </execution>
    187183                                </executions>
  • party/src/main/java/geniusweb/party/Capabilities.java

    r10 r24  
    1414public class Capabilities {
    1515        /**
    16          * List of supported protocols
     16         * List of supported protocol names
    1717         */
    1818        private final Set<String> behaviours;
     
    2020        /**
    2121         *
    22          * @param protocols the protocols that a Party can handle
     22         * @param behaviours the protocols that a Party can handle
    2323         */
    2424        @JsonCreator
  • party/src/test/java/geniusweb/party/inform/FinishedTest.java

    r21 r24  
    8989        }
    9090
    91         @Test
     91        @Test(expected = NullPointerException.class)
    9292        public void nullTest() throws URISyntaxException {
    9393                new Finished(null);
  • profile/pom.xml

    r23 r24  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>profile</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    157157                                <groupId>org.apache.maven.plugins</groupId>
    158158                                <artifactId>maven-javadoc-plugin</artifactId>
    159                                 <version>2.10.1</version>
     159                                <version>3.2.0</version>
    160160                                <executions>
    161161                                        <execution>
     
    164164                                                        <goal>jar</goal>
    165165                                                </goals>
    166                                                 <configuration>
    167                                                         <additionalparam>${javadoc.opts}</additionalparam>
    168                                                         <additionalparam>-Xdoclint:none</additionalparam>
    169                                                 </configuration>
    170166                                        </execution>
    171167                                </executions>
  • profile/src/main/java/geniusweb/profile/DefaultPartialOrdering.java

    r10 r24  
    3737        /**
    3838         *
    39          * @param name
    40          * @param domain
    41          * @param reservationbid
    42          * @param bids
     39         * @param name           name of the profile
     40         * @param domain         the {@link Domain}
     41         * @param reservationbid the reservation bid, this is the minimum acceptable
     42         *                       bid
     43         * @param bids           a list of bids that this ordering contains
     44         *                       comparisons for
    4345         * @param isbetterList   a list of tuples [bid1index, bid2index]. It
    4446         *                       indicates that bids[bid1index] isbetterthan
  • profile/src/main/java/geniusweb/profile/FullOrdering.java

    r1 r24  
    1111         * @param bid1 the first item's utility/preference
    1212         * @param bid2 the second item's utility/preference
    13          * @return true iff bid1 is considered better or equal (&ge;) than bid 2. In all
    14          *         other cases false is returned.
     13         * @return true iff bid1 is considered better or equal (&ge;) than bid 2. In
     14         *         all other cases false is returned.
    1515         *
    1616         *         This predicate should be implemented such that
     17         *         <ul>
    1718         *         <li>For all b1 and b2, either b1 &ge; b2 or b2 &ge; b1.
    1819         *         <li>b &ge; b (every bid is better or equal to itself)
    19          *         <li>If b1&ge;b2 and b2&ge;b1 then the two bids are considered equally
    20          *         good. Note that this differes from a partial order in mathematics.
    21          *         <li>it behaves transitive: if b1&ge;b2 and b2&ge;b3 then b1&ge;b3.
     20         *         <li>If b1&ge;b2 and b2&ge;b1 then the two bids are considered
     21         *         equally good. Note that this differes from a partial order in
     22         *         mathematics.
     23         *         <li>it behaves transitive: if b1&ge;b2 and b2&ge;b3 then
     24         *         b1&ge;b3.
     25         *         </ul>
    2226         */
    2327        @Override
  • profile/src/main/java/geniusweb/profile/PartialOrdering.java

    r1 r24  
    1313         * @param bid1 the first item's utility/preference
    1414         * @param bid2 the second item's utility/preference
    15          * @return true iff bid1 is considered better or equal (&ge;) than bid 2. In all
    16          *         other cases false is returned. A bid may not have a &ge; relation at
    17          *         all.
     15         * @return true iff bid1 is considered better or equal (&ge;) than bid 2. In
     16         *         all other cases false is returned. A bid may not have a &ge;
     17         *         relation at all.
    1818         *
    1919         *         This predicate should be implemented such that
     20         *         <ul>
    2021         *         <li>b &ge; b (every bid is better or equal to itself)
    21          *         <li>If b1&ge;b2 and b2&ge;b1 then the two bids are considered equally
    22          *         good. Note that this differes from a partial order in mathematics.
    23          *         <li>it behaves transitive: if b1&ge;b2 and b2&ge;b3 then b1&ge;b3.
     22         *         <li>If b1&ge;b2 and b2&ge;b1 then the two bids are considered
     23         *         equally good. Note that this differes from a partial order in
     24         *         mathematics.
     25         *         <li>it behaves transitive: if b1&ge;b2 and b2&ge;b3 then
     26         *         b1&ge;b3.
     27         *         </ul>
    2428         */
    2529        boolean isPreferredOrEqual(Bid bid1, Bid bid2);
  • profile/src/main/java/geniusweb/profile/Profile.java

    r9 r24  
    3636         *
    3737         * @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
    42          *         "reservation value" and is more general. If null, there is no
    43          *         reservation bid and any agreement is better than no agreement.
     38         *         non-agreement. Only bids that are equal or better should be
     39         *         accepted. If a negotiation does not reach an agreement, the party
     40         *         can get this offer somewhere else. This replaces the older notion
     41         *         of a "reservation value" and is more general. If null, there is
     42         *         no reservation bid and any agreement is better than no agreement.
    4443         *
    4544         */
  • profile/src/main/java/geniusweb/profile/utilityspace/DiscreteValueSetUtilities.java

    r10 r24  
    2020 * issue so may need further checking when used for an actual issue. Constructor
    2121 * guarantees that
     22 * <ul>
    2223 * <li>All values in the provided map (the utilities) are in [0,1]
    2324 * <li>All keys are proper {@link DiscreteValue}s
     25 * </ul>
    2426 */
    2527@JsonTypeName("discreteutils")
  • profile/src/main/java/geniusweb/profile/utilityspace/LinearAdditive.java

    r10 r24  
    2222        /**
    2323         *
    24          * @param issue
     24         * @param issue the issue name
    2525         * @return the weight of the given issue
    2626         */
  • profile/src/main/java/geniusweb/profile/utilityspace/LinearAdditiveUtilitySpace.java

    r14 r24  
    2020 *
    2121 * Constructor guarantees that
     22 * <ul>
    2223 * <li>weights are normalized to 1
    2324 * <li>the issues in the utility map and weights map match those in the domain
    2425 * <li>The utilities for each issue are proper {@link ValueSetUtilities} objects
     26 * </ul>
    2527 */
    2628@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE)
  • profile/src/main/java/geniusweb/profile/utilityspace/NumberValueSetUtilities.java

    r14 r24  
    4040         * @param lowUtility  the utility of the {@link #lowValue}
    4141         * @param highValue   the high value of the {@link Range}. Must be
    42          *                    >lowValue.
     42         *                    &gt;lowValue.
    4343         * @param highUtility the utility of the {@link #highValue}
    4444         */
  • profile/src/main/java/geniusweb/profile/utilityspace/PartsUtilities.java

    r9 r24  
    1919/**
    2020 * Contains utilities of a ProductOfValue of a {@link SumOfGroupsUtilitySpace}.
    21  * So this is similar to a DiscreteValueSetUtilities but instead of issues this
    22  * contains an (ordered) list of issues. This object serializes to something
    23  * like <code>
     21 * So this is similar to a {@link DiscreteValueSetUtilities} but instead of
     22 * issues this contains an (ordered) list of issues. This object serializes to
     23 * something like <code>
    2424 * {"partsutils":
    2525 * {"issues":["issue1","issue2"],
     
    2929 * N issue values, in the same order as the issues list and with "util"
    3030 * containng the utility value of that set of values.
    31  * <p>
    3231 */
    3332@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE)
     
    4342        /**
    4443         *
    45          * @param issues
     44         * @param issues list of issues
    4645         * @param utils  with keys: list of values and value: utility value for that
    4746         *               list of values. All list-of-values missing from the map are
  • profile/src/main/java/geniusweb/profile/utilityspace/ProductOfValue.java

    r9 r24  
    1919
    2020        /**
    21          * @param values the values to make a product of
     21         * @param newvals the values to make a product of
    2222         */
    2323        @JsonCreator
  • profile/src/main/java/geniusweb/profile/utilityspace/SumOfGroupsUtilitySpace.java

    r10 r24  
    4747
    4848        /**
    49          * @param domain  the {@link Domain} in which this profile is defined.
    50          * @param name    the name of this profile. Must be simple name (a-Z, 0-9)
    51          * @param utils   a map with key: part names (String) and value: the
    52          *                {@link PartsUtilities} for that part. There MUST NOT be a
    53          *                null part name. All values MUST NOT be null. The
    54          *                PartsUtilities must match the
    55          * @param weights the weight of each part, for the computation of the
    56          *                weighted sum. The parts must be the same as those in the
    57          *                utils map. All weights MUST NOT be null. The weights MUST
    58          *                sum to 1.
    59          * @param resBid  the reservation bid. Only bids that are
    60          *                {@link #isPreferredOrEqual(Bid, Bid)} should be accepted.
    61          *                Can be null, meaning that there is no reservation bid and
    62          *                any agreement is better than no agreement.
     49         * @param domain    the {@link Domain} in which this profile is defined.
     50         * @param name      the name of this profile. Must be simple name (a-Z, 0-9)
     51         * @param partutils a map with key: part names (String) and value: the
     52         *                  {@link PartsUtilities} for that part. There MUST NOT be
     53         *                  a null part name. All values MUST NOT be null. The
     54         *                  PartsUtilities must match the
     55         * @param resBid    the reservation bid. Only bids that are
     56         *                  {@link #isPreferredOrEqual(Bid, Bid)} should be
     57         *                  accepted. Can be null, meaning that there is no
     58         *                  reservation bid and any agreement is better than no
     59         *                  agreement.
    6360         * @throws NullPointerException     if values are incorrectly null.
    6461         * @throws IllegalArgumentException if preconditions not met.
     
    6865                        @JsonProperty("name") String name,
    6966                        @JsonProperty("partUtilities") HashMap<String, PartsUtilities> partutils,
    70                         // @JsonProperty("partWeights") Map<String, BigDecimal> weights,
    7167                        @JsonProperty("reservationBid") Bid resBid) {
    7268                super(name, domain, resBid);
  • profile/src/main/java/geniusweb/profile/utilityspace/ValueSetUtilities.java

    r1 r24  
    55import com.fasterxml.jackson.annotation.JsonSubTypes;
    66import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
     7import com.fasterxml.jackson.annotation.JsonTypeInfo;
    78
    89import geniusweb.issuevalue.Value;
    910import geniusweb.issuevalue.ValueSet;
    10 
    11 import com.fasterxml.jackson.annotation.JsonTypeInfo;
    1211
    1312/**
     
    1615 */
    1716@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
    18 @JsonSubTypes({ @Type(value = DiscreteValueSetUtilities.class), @Type(value = NumberValueSetUtilities.class) })
     17@JsonSubTypes({ @Type(value = DiscreteValueSetUtilities.class),
     18                @Type(value = NumberValueSetUtilities.class) })
    1919public interface ValueSetUtilities {
    2020        /**
    2121         *
    22          * @param value
    23          * @return the utility of the given value. MUST be in [0,1]. Should return 0 if
    24          *         the value is unknown.
     22         * @param value the {@link Value} to get the utility for
     23         * @return the utility of the given value. MUST be in [0,1]. Should return 0
     24         *         if the value is unknown.
    2525         */
    2626        BigDecimal getUtility(Value value);
     
    2828        /**
    2929         *
    30          * @param values the valueset that
     30         * @param valueset the valueset that is supposed match with this
    3131         * @return null if the ValueSetUtilities fits the given set of values , that
    32          *         means it can give utilities for all possible values in valueset. Or a
    33          *         string containing an explanation why not.
     32         *         means it can give utilities for all possible values in valueset.
     33         *         Or a string containing an explanation why not.
    3434         */
    3535        String isFitting(ValueSet valueset);
  • profileconnection/pom.xml

    r23 r24  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>profileconnection</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    162162                                <groupId>org.apache.maven.plugins</groupId>
    163163                                <artifactId>maven-javadoc-plugin</artifactId>
    164                                 <version>2.10.1</version>
     164                                <version>3.2.0</version>
    165165                                <executions>
    166166                                        <execution>
     
    169169                                                        <goal>jar</goal>
    170170                                                </goals>
    171                                                 <configuration>
    172                                                         <additionalparam>${javadoc.opts}</additionalparam>
    173                                                         <additionalparam>-Xdoclint:none</additionalparam>
    174                                                 </configuration>
    175171                                        </execution>
    176172                                </executions>
  • profileconnection/src/main/java/geniusweb/profileconnection/ProfileConnectionFactory.java

    r1 r24  
    1717
    1818        /**
    19          * @uri the URI that can provide the {@link Profile}. Support both the ws
    20          *      and the file scheme for the uri.
     19         * @param uri      the URI that can provide the {@link Profile}. Support
     20         *                 both the ws and the file scheme for the uri.
    2121         * @param reporter the {@link Reporter} to log issues to
     22         * @return a {@link ProfileInterface}
     23         * @throws IOException         if connection can't be made
     24         * @throws DeploymentException if endpoint can't be published
    2225         */
    2326        public static ProfileInterface create(URI uri, Reporter reporter)
  • profileconnection/src/main/java/geniusweb/profileconnection/ProfileInterface.java

    r10 r24  
    1414         * @return the latest version of the profile. May change at any time, after
    1515         *         someone updates the version on the server. Call to this may block
    16          *         for limited time if the profile is not yet available.
    17          *         @throws IOException if profile can not be fetched     */
     16         *         for limited time if the profile is not yet available.
     17         * @throws IOException if profile can not be fetched
     18         */
    1819        public Profile getProfile() throws IOException;
    1920}
  • profileconnection/src/main/java/geniusweb/profileconnection/WebsocketProfileConnector.java

    r20 r24  
    3737         *                    websockets. Typically ContainerProvider
    3838         *                    .getWebSocketContainer()
    39          * @throws DeploymentException
    40          * @throws IOException
     39         * @throws DeploymentException if the annotated endpoint instance is not
     40         *                             valid
     41         * @throws IOException         if there was a network or protocol problem
     42         *                             that prevented the client endpoint being
     43         *                             connected to its server.
     44         *
    4145         */
    4246        public WebsocketProfileConnector(URI uri, Reporter reporter,
  • protocol/pom.xml

    r23 r24  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>protocol</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    2828
    2929        <dependencies>
    30                         <dependency>
     30                <dependency>
    3131                        <groupId>geniusweb</groupId>
    3232                        <artifactId>issuevalue</artifactId>
     
    4343                        <version>${geniusweb.version}</version>
    4444                </dependency>
    45 <!--            <dependency>
    46                         <groupId>geniusweb</groupId>
    47                         <artifactId>party</artifactId>
    48                         <version>${geniusweb.version}</version>
    49                 </dependency>
    50  -->            <dependency>
     45                <dependency>
    5146                        <groupId>geniusweb</groupId>
    5247                        <artifactId>references</artifactId>
     
    191186                                <groupId>org.apache.maven.plugins</groupId>
    192187                                <artifactId>maven-javadoc-plugin</artifactId>
    193                                 <version>2.10.1</version>
     188                                <version>3.2.0</version>
    194189                                <executions>
    195190                                        <execution>
     
    198193                                                        <goal>jar</goal>
    199194                                                </goals>
    200                                                 <configuration>
    201                                                         <additionalparam>${javadoc.opts}</additionalparam>
    202                                                         <additionalparam>-Xdoclint:none</additionalparam>
    203                                                 </configuration>
    204195                                        </execution>
    205196                                </executions>
  • protocol/src/main/java/geniusweb/protocol/NegoProtocol.java

    r21 r24  
    1313import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
    1414import geniusweb.protocol.session.SessionProtocol;
    15 import geniusweb.protocol.session.SessionSettings;
    1615import geniusweb.protocol.session.SessionState;
    1716import geniusweb.protocol.tournament.TournamentProtocol;
     
    3029 *
    3130 * A protocol is mutable because the incoming connections cause state changes.
    32  * But it is recommended to push all changing properties into the state.
     31 * But it is recommended to push changing properties into the state so that the
     32 * complete state can be recovered and analysed.
    3333 * <p>
    3434 * Because a protocol contains an internal state, it can be used only once.
    35  * <p>
    3635 * <p>
    3736 * The protocol can emit a {@link CurrentState} event at any time. It should do
     
    4241 * which it can resolve received {@link Reference}s. <br>
    4342 * First call to instances <b>must be</b>
    44  * {@link #start(SessionSettings, ConnectionFactory)}.
     43 * {@link #start(ProtocolToPartyConnFactory)}.
    4544 *
    4645 * <h2>Ensure time deadline</h2>
     
    4847 * The protocol also needs to keep an eye on the deadline and take appropriate
    4948 * actions when the deadline is reached. <br>
    50  * A protocol should emit a {@link SessionEnded} or {@link TournamentEnded}
    51  * event when it is finished.
    5249 * <p>
    5350 * All protocol implementations must ensure that the deadline is kept and that
     
    7370         * <p>
    7471         *
    75          * All errors are to be handled through {@link SessionState#getError()}
    76          * except for plain {@link IllegalArgumentException}s. <br>
     72         * All errors are to be handled through {@link SessionState#getResult()}
     73         * except for bugs that use {@link RuntimeException} like
     74         * {@link IllegalArgumentException}s. <br>
    7775         * The protocol usually uses the incoming connections to keep running. It
    7876         * does not need to run in a separate thread or so.
  • protocol/src/main/java/geniusweb/protocol/NegoState.java

    r21 r24  
    1111
    1212/**
    13  * The current state of the session/tournament. Must be serializabl;e so that it
    14  * can be restarted if a crash occurs.
     13 * The current state of the session/tournament. Must be (de)serializabl;e so
     14 * that it can be restarted if a crash occurs. Notice that this restart
     15 * functionality is not yet available.
     16 * <p>
     17 * In general the state contains all the information to control the flow of the
     18 * negotiation: who did what, are we finished, etc. This object may be stored to
     19 * record the final result as well
    1520 */
    1621@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE)
  • protocol/src/main/java/geniusweb/protocol/ProtocolException.java

    r21 r24  
    55
    66/**
    7  * thrown if a {@link Party} violates the protocols (that includes
    8  * disconnecting).
     7 * thrown if a Party violates the protocols (that includes disconnecting).
    98 */
    109public class ProtocolException extends Exception {
  • protocol/src/main/java/geniusweb/protocol/partyconnection/ProtocolToPartyConnections.java

    r21 r24  
    4949
    5050        /**
    51          * Broadcast info to all parties
     51         * Broadcast info to all parties. Notice that the broadcast immediately
     52         * aborts if an error occurs and remaining parties will not receive the
     53         * event. Therefore it is recommended to instead send to all parties
     54         * individually to ensure all parties are handled individually.
    5255         *
    5356         * @param info the {@link Inform} to broadcast
     57         * @throws IOException if the send fails.
    5458         */
    5559        public void broadcast(Inform info) throws IOException {
     
    6872
    6973        /**
    70          * @param i
     74         * @param i the connection number
    7175         * @return the ith connection
    7276         */
  • protocol/src/main/java/geniusweb/protocol/session/SessionResult.java

    r23 r24  
    6767
    6868        /**
    69          * 8return the final {@link Agreements} of the session. May be empty, not
    70          * null
     69         * @return the final {@link Agreements} of the session. May be empty, not
     70         *         null
    7171         */
    7272        public Agreements getAgreements() {
  • protocol/src/main/java/geniusweb/protocol/session/SessionState.java

    r21 r24  
    1818 * and the parties currently connected. <br>
    1919 * The state checks if transitions (Actions from the party) are following the
    20  * protocol, and thus implement most of the protocol . See
    21  * {@link #with(geniusweb.actions.PartyId, Action)}. <br>
    22  *
    23  * Use {@link #with(geniusweb.actions.PartyId, Action)} and
    24  * {@link #with(geniusweb.actions.PartyId, tudelft.utilities.connection.Connection)}
    25  * to create a new state <br>
    26  *
     20 * protocol, and thus implement most of the protocol . <br>
    2721 *
    2822 * If protocol errors occur, these should be stored in the state and the state
    29  * should become {@link #isFinal()}. Throwing should happen only in case of a
    30  * bug.<br>
     23 * should become {@link #isFinal(long)}. Throwing should happen only in case of
     24 * a bug.<br>
    3125 *
    3226 * Implementations should be immutable (to ensure thread safety, testability
     
    6660         * @return the current standing agreement, or null if there is no agreement
    6761         *         at this point. An agreement does not necessarily mean
    68          *         {@link #isFinal()}.
     62         *         {@link #isFinal(long)}.
    6963         */
    7064        Agreements getAgreements();
     
    7266        /**
    7367         *
    74          * @return the {@link SessionResult}. Assumes {@link #isFinal(long)}. result
    75          *         may be undefined if not.
     68         * @return the {@link SessionResult} which is a short report of the final
     69         *         outcome. Assumes {@link #isFinal(long)}. result may be undefined
     70         *         if not.
    7671         */
    7772        SessionResult getResult();
  • protocol/src/main/java/geniusweb/protocol/session/amop/AMOP.java

    r21 r24  
    2828import geniusweb.protocol.CurrentNegoState;
    2929import geniusweb.protocol.ProtocolException;
    30 import geniusweb.protocol.WillBeCalled;
    3130import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
    3231import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
     
    5150 * <h1>parameter</h1> AMOP parties can receive a parameter: minVotes containing
    5251 * a Double. If set, the AMOP protocol checks that all {@link Votes} from that
    53  * party have {@link Vote#getMinPower()} > minVotes.
    54  * <h1>Protocol steps</h1> The protocol tries to start all parties. If not all
    55  * parties start, the parties are freed up and another attempt is done to start
    56  * all parties some time later.
     52 * party have {@link Vote#getMinPower()} &gt; minVotes.
     53 * <h1>Protocol steps</h1>
     54 * <ol>
     55 * <li>The protocol tries to start all parties. If not all parties start, the
     56 * parties are freed up and another attempt is done to start all parties some
     57 * time later.
    5758 * <li>the variable remainingparties = {all parties}
    5859 * <li>The session deadline clock now starts ticking.
    5960 * <li>All parties are sent their settings.
    60  * <li>Loop until {@link Deadline} is reached or |remainingparties|<2:
     61 * <li>Loop until {@link Deadline} is reached or |remainingparties|&lt;2:
    6162 * <ol>
    6263 * <li>protocol sends {@link YourTurn} to all remainingparties. Each party now
    6364 * must submit an {@link Offer} within {@link #PHASE_TIME} seconds. If a party
    6465 * fails to submit it is send Finished and removed from from remainingparties.
    65  * <li>protocol sends a {@link Voting} containing a List<Bid> containing all
    66  * received {@link Bid}s. Each party must place his {@link Votes} within
    67  * {@link #PHASE_TIME} seconds. If a party does not submit, it is send a
     66 * <li>protocol sends a {@link Voting} containing a List of {@link Bid}
     67 * containing all received {@link Bid}s. Each party must place his {@link Votes}
     68 * within {@link #PHASE_TIME} seconds. If a party does not submit, it is send a
    6869 * {@link Finished} and removed from remainingparties. Previous votes for the
    6970 * same bid do not count. But see {@link Agreements}.
    70  * <li>The protocol determines a maximum sized subset of size N>=2 of the votes
    71  * for bid B for which the vote conditions hold. If there is such a subset, the
    72  * parties that placed these votes reached an agreement. They are added to the
    73  * agreement set, sent the {@link Finished} info and terminated. They are
    74  * removed from the remainingparties.
     71 * <li>The protocol determines a maximum sized subset of size N&ge;2 of the
     72 * votes for bid B for which the vote conditions hold. If there is such a
     73 * subset, the parties that placed these votes reached an agreement. They are
     74 * added to the agreement set, sent the {@link Finished} info and terminated.
     75 * They are removed from the remainingparties.
    7576 * </ol>
    7677 * <li>Any remaining parties are sent a {@link Finished} object without
     
    109110        /**
    110111         *
    111          * @param state normally the initial state coming from SAOPSettings
     112         * @param state  normally the initial state coming from SAOPSettings
     113         * @param logger the {@link Reporter} to use
    112114         */
    113115        public AMOP(AMOPState state, Reporter logger) {
     
    218220         * overridable factory method, used for testing.
    219221         *
    220          * @param r
    221          * @param delayMs
     222         * @param r       the {@link Runnable} that will be called
     223         * @param delayMs the time after which r will be called
    222224         * @return new WillBeCalled(r,delayms)
    223225         */
  • protocol/src/main/java/geniusweb/protocol/session/amop/AMOPSettings.java

    r21 r24  
    3030         *                     protocol. But SAOP can be initialized with less, for
    3131         *                     use in TournamentSettings.
    32          * @param deadline
    33          * @param minimumVotes the minimum number of votes allowed for a bid.
     32         * @param deadline     the {@link Deadline} of the negotiation
    3433         */
    3534        @JsonCreator
  • protocol/src/main/java/geniusweb/protocol/session/amop/AMOPState.java

    r23 r24  
    197197
    198198        /**
    199          * @param actor         the actor that did this action. Can be used to check
    200          *                      if action is valid. NOTICE caller has to make sure
    201          *                      the current state is not final. MUST NOT be null.
    202          * @param action        the action that was proposed by actor. MUST NOT be
    203          *                      null.
    204          * @param currentTimeMs the current time in ms since 1970, see
    205          *                      {@link System#currentTimeMillis()}
     199         * @param actor  the actor that did this action. Can be used to check if
     200         *               action is valid. NOTICE caller has to make sure the current
     201         *               state is not final. MUST NOT be null.
     202         * @param action the action that was proposed by actor. MUST NOT be null.
    206203         * @return new SessionState with the action added as last action.
    207204         * @throws ProtocolException if actor is violating the protocol
  • protocol/src/main/java/geniusweb/protocol/session/mopac/MOPAC.java

    r23 r24  
    22
    33import java.io.IOException;
     4import java.util.Collections;
    45import java.util.List;
    56import java.util.Timer;
     
    5556 * parties are freed up and another attempt is done to start all parties some
    5657 * time later.
    57  * <li>the variable remainingparties = {all parties}
    5858 * <li>The session deadline clock now starts ticking.
    5959 * <li>remainingparties are sent their settings.
    60  * <li>Loop until {@link Deadline} is reached or |remainingparties|<2:
     60 * <li>Loop until {@link Deadline} is reached or |remainingparties| &le; 2:
    6161 * <ol>
    6262 * <li>protocol sends {@link YourTurn} to all remainingparties. Each party now
    6363 * must submit an {@link Offer} within {@link Phase#PHASE_MAXTIME} seconds. If a
    6464 * party fails to submit it is removed from from remainingparties.
    65  * <li>protocol sends a {@link Voting} containing a List<Bid> containing all
    66  * received {@link Bid}s. Each party must place his {@link Votes} within
    67  * {@link #PHASE_TIME} seconds. If a party does not submit, it is terminated and
    68  * removed from remainingparties. Previous votes for the same bid do not count.
    69  * But see {@link Agreements}. A party that misbehaves after submitting its vote
    70  * is removed but it Votes remain standing.
     65 * <li>protocol sends a {@link Voting} containing a List of Bid containing all
     66 * received {@link Bid}s. Each party must place his {@link Votes} within the
     67 * provided deadline. If a party does not submit, it is terminated and removed
     68 * from remainingparties. Previous votes for the same bid do not count. But see
     69 * {@link Agreements}. A party that misbehaves after submitting its vote is
     70 * removed but it Votes remain standing.
    7171 * <li>protocol sends to all remainingparties a OptIn containing all received
    72  * votes. Each party now must submit again a {@link Votes} object within
    73  * {@link #PHASE_TIME} seconds. This new Votes must equal or extend the previous
    74  * Votes of the party.
    75  * <li>The protocol use the {@link MOPACState#getEvaluator()} to determine the
    76  * ... . If there is such a subset, the parties that placed these votes reached
    77  * an agreement. They are added to the agreement set, sent the {@link Finished}
    78  * info and terminated. They are removed from the remainingparties.
     72 * votes. Each party now must submit again a {@link Votes} object within the
     73 * deadline. This new Votes must equal or extend the previous Votes of the
     74 * party.
     75 * <li>The protocol uses the {@link Phase#getEvaluator()} to determine the
     76 * agreements from the votes. If there are agreements, the parties that placed
     77 * these votes reached an agreement. They are moved to the agreement set and
     78 * removed from the remainingparties.
    7979 * </ol>
    8080 * <li>Any remaining parties are sent a {@link Finished} object without
     
    114114        private final Reporter log;
    115115        private MOPACState state = null; // mutable!
     116        /**
     117         * the existing party connections. we assume ownership of this so it should
     118         * not be modified although connections may of course break. mutable!
     119         */
     120        private ProtocolToPartyConnections connections = new ProtocolToPartyConnections(
     121                        Collections.emptyList());
    116122
    117123        /**
     
    124130        /**
    125131         *
    126          * @param state normally the initial state coming from SAOPSettings
     132         * @param state  normally the initial state coming from SAOPSettings
     133         * @param logger the {@link Reporter} to use
    127134         */
    128135        public MOPAC(MOPACState state, Reporter logger) {
     
    145152                        ProtocolToPartyConnFactory connectionfactory) {
    146153                try {
    147                         // System.out.println("starting MOPAC");
    148                         // we're in Phase.INIT still
    149154                        connect(connectionfactory);
    150                         setupParties();
    151                         long now = System.currentTimeMillis();
    152                         state = state.initPhase(now);
    153                         startPhase(now);
    154155                } catch (Throwable e) {
    155                         e.printStackTrace();
    156                         handleError("Failed to start MOPAC session", new PartyId("BUG"), e);
    157                 }
     156                        /** We can't {@link #handleError} yet. FIXME */
     157                        throw new RuntimeException("Failed to connect", e);
     158                }
     159                long now = System.currentTimeMillis();
     160                state = state.initPhase(
     161                                ProgressFactory.create(state.getSettings().getDeadline(), now),
     162                                now);
     163                setupParties(now);
     164                startPhase(now);
     165
    158166        }
    159167
     
    212220                                .map(parti -> (parti.getParty().getPartyRef()))
    213221                                .collect(Collectors.toList());
    214                 List<ProtocolToPartyConn> connections = null;
    215222                log.log(Level.INFO, "MOPAC connect " + parties);
    216                 while (connections == null) {
     223                List<ProtocolToPartyConn> newconnections = null;
     224                while (newconnections == null) {
    217225                        try {
    218                                 connections = connectionfactory.connect(parties);
     226                                newconnections = connectionfactory.connect(parties);
    219227                        } catch (NoResourcesNowException e) {
    220228                                long waitms = e.getLater().getTime()
     
    228236                }
    229237                for (int i = 0; i < participants.size(); i++) {
    230                         state = state.with(connections.get(i), participants.get(i));
     238                        ProtocolToPartyConn conn = newconnections.get(i);
     239                        connections = connections.with(conn);
     240                        state = state.with(conn.getParty(), participants.get(i));
    231241                }
    232242        }
     
    239249         * part of the interface.
    240250         *
    241          * @throws ProtocolException if a party does not follow the protocol
    242          */
    243         protected synchronized void setupParties() throws ProtocolException {
    244                 for (ProtocolToPartyConn conn : state.getConnections()) {
    245                         conn.addListener(action -> actionRequest(conn, action,
    246                                         System.currentTimeMillis()));
    247                 }
    248                 Long now = System.currentTimeMillis();
    249                 state = state.with(
    250                                 ProgressFactory.create(state.getSettings().getDeadline(), now));
    251                 for (ProtocolToPartyConn connection : state.getConnections()) {
     251         * @param now the current time.
     252         */
     253        protected synchronized void setupParties(long now) {
     254                for (ProtocolToPartyConn conn : connections) {
     255                        conn.addListener(action -> actionRequest(conn, action, now));
     256                }
     257                for (ProtocolToPartyConn connection : connections) {
    252258                        try {
    253259                                sendSettings(connection);
     
    257263                        }
    258264                }
    259 
    260265        }
    261266
     
    357362                                .getNegotiatingParties()) {
    358363                        try {
    359                                 state.getConnections().get(party).send(info);
     364                                connections.get(party).send(info);
    360365                        } catch (IOException e) {
    361                                 handleError("Party seems to have disconnected", party, e);
    362                         }
    363                 }
    364         }
    365 
    366         /**
    367          * Update state to include the given error and closes the party.
    368          *
    369          * @param message The message to attach to the error
    370          * @param party   the party where the error occured
    371          * @param e       the exception that occured.
    372          */
    373         private void handleError(final String message, final PartyId partyid,
    374                         final Throwable e) {
    375                 if (e instanceof ProtocolException) {
    376                         state = state.with((ProtocolException) e);
    377                 } else {
    378                         state = state.with(new ProtocolException(message, partyid, e));
    379                 }
    380                 log.log(Level.WARNING,
    381                                 "MOPAC intercepted error from party " + partyid + ":" + message,
    382                                 e);
    383         }
    384 
    385 //      /**
    386 //       * Sets the new state. If the new state is final, the finish-up procedure is
    387 //       * executed. All state changes go through here to ensure we check isFinal
    388 //       * before any state change.
    389 //       *
    390 //       * @param newstate the new state.
    391 //       */
    392 //      private synchronized void setState(MOPACState newstate) {
    393 //              long now = System.currentTimeMillis();
    394 //              if (state.isFinal(now)) {
    395 //                      endNegotiation();
    396 //                      return;
    397 //              }
    398 //
    399 //              this.state = newstate;
    400 //              if (newstate.isFinal(now)) {
    401 //                      endNegotiation();
    402 //              }
    403 //      }
     366                                state = state.with(new ProtocolException(
     367                                                "Party seems to have disconnected", party, e));
     368                        }
     369                }
     370        }
    404371
    405372        /**
     
    413380                finished = true;
    414381                Finished info = new Finished(state.getAgreements());
    415                 for (ProtocolToPartyConn conn : state.getConnections()) {
     382                for (ProtocolToPartyConn conn : connections) {
    416383                        try {
    417384                                conn.send(info);
  • protocol/src/main/java/geniusweb/protocol/session/mopac/MOPACSettings.java

    r21 r24  
    1919/**
    2020 * Settings for MOPAC negotiation. in MOPAC, each party may get a "power"
    21  * parameter containing an natural number >=1.
     21 * parameter containing an natural number &le;1.
    2222 */
    2323public class MOPACSettings implements SessionSettings {
     
    3030         * @param participants the list of {@link PartyWithProfile} in clockwise
    3131         *                     order. There must be at least 2 to run the MOPAC
    32          *                     protocol. But SAOP can be initialized with less, for
    33          *                     use in TournamentSettings.
    34          *
    35          *                     All provided participants must
    36          *
    37          * @param deadline
    38          * @param minimumVotes the minimum number of votes allowed for a bid.
     32         *                     protocol. This is not tested in the constructor
     33         *                     because this can be initialized with less, for use in
     34         *                     TournamentSettings.
     35         * @param deadline     the {@link Deadline} for the negotiation
     36         * @param votingeval   the {@link VotingEvaluator} to use.
    3937         */
    4038        @JsonCreator
     
    9088
    9189        @Override
    92         public SessionSettings with(TeamOfPartiesAndProfiles party) {
     90        public MOPACSettings with(TeamOfPartiesAndProfiles party) {
    9391                if (!(party instanceof OnePartyTeam))
    9492                        throw new IllegalArgumentException(
  • protocol/src/main/java/geniusweb/protocol/session/mopac/MOPACState.java

    r23 r24  
    1717import geniusweb.progress.Progress;
    1818import geniusweb.progress.ProgressRounds;
     19import geniusweb.protocol.NegoProtocol;
    1920import geniusweb.protocol.ProtocolException;
    20 import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
    21 import geniusweb.protocol.partyconnection.ProtocolToPartyConnections;
    2221import geniusweb.protocol.session.SessionResult;
    2322import geniusweb.protocol.session.SessionState;
     
    2726import geniusweb.protocol.session.saop.SAOPSettings;
    2827import geniusweb.references.PartyWithProfile;
    29 import geniusweb.voting.VotingEvaluator;
    30 
     28
     29/**
     30 * Keeps track of the current {@link Phase}. Adds initializing stuff and
     31 * time/deadline checking. This state does not contain connections, this assumes
     32 * that someone else handles (i.e. {@link NegoProtocol} that and the connections
     33 * with the parties and that negotiation events are just pumped in from there.
     34 * <p>
     35 * This object is a bit tricky. It has two states
     36 * <ol>
     37 * <li>The initial state, where phase=null and connections are being made to all
     38 * parties. At this point, problems can not be handled nicely yet because there
     39 * are no PartyId's for problematic parties
     40 * <li>The working state, where all parties are connected and all problems can
     41 * be connected to an offending party.
     42 * </ol>
     43 */
    3144public class MOPACState implements SessionState {
    3245
    33         private final Phase phase;
     46        private final Phase phase; // maybe null while initializing
    3447        private final MOPACSettings settings;
    3548        private final Map<PartyId, PartyWithProfile> partyprofiles;
    36         private final ProtocolToPartyConnections connections;
    3749        private final List<Action> actions;
    3850        private final Progress progress;
     
    4456         */
    4557        public MOPACState(MOPACSettings settings) {
    46                 this(null, Arrays.asList(),
    47                                 new ProtocolToPartyConnections(Collections.emptyList()), null,
    48                                 settings, Collections.emptyMap());
     58                this(null, Arrays.asList(), null, settings, Collections.emptyMap());
    4959
    5060        }
     
    5464         *                      set something only after we have connections.
    5565         * @param actions       the legal actions that have been done in the
    56          *                      negotiation. A new-sub-list is added for each phase
    57          *                      change. It is assumed that the last element of the
    58          *                      list is the list with actions taken in the current
    59          *                      phase. first action in first list is the oldest.
    60          *                      This MUST NOT contain illegal actions. Parties doing
    61          *                      illegal actions are killed and the offending action
    62          *                      ends up in the stacktrace. Previous actions of
    63          *                      crashed parties remain standing and valid.
    64          * @param conns         the existing party connections. we assume ownership
    65          *                      of this so it should not be modified although
    66          *                      connections may of course break.
     66         *                      negotiation. {@link PartyStates#getActions()} is
     67         *                      called to collect the actions after the phase is
     68         *                      finished.first action in list is the oldest. This
     69         *                      will not contain actions that immediately led to an
     70         *                      agreement, because {@link PartyStates} removes the
     71         *                      actions that led to an agreement. This MUST NOT
     72         *                      contain illegal actions. Parties doing illegal
     73         *                      actions are killed and the offending action ends up
     74         *                      in the stacktrace. Previous actions of crashed
     75         *                      parties remain standing and valid.
    6776         * @param progress      the {@link Progress} line. can be null if not yet
    68          *                      known. This happens because during setup we first
    69          *                      add all connections, and only when we have that we
    70          *                      set the correct deadline.
     77         *                      known. null happens because during initialization
     78         *                      phase the protocol first add all connections. During
     79         *                      this time, parties may already enter the
     80         *                      failed/exception state.
    7181         * @param settings      the {@link SAOPSettings}
    7282         * @param partyprofiles map with the {@link PartyWithProfile} for connected
    7383         *                      parties. null is equivalent to an empty map.
    74          * @param evaluator     the {@link VotingEvaluator}
    7584         */
    7685        @JsonCreator
    7786        protected MOPACState(@JsonProperty("phase") Phase phase,
    7887                        @JsonProperty("actions") List<Action> actions,
    79                         @JsonProperty("connections") ProtocolToPartyConnections conns,
    8088                        @JsonProperty("progress") Progress progress,
    8189                        @JsonProperty("settings") MOPACSettings settings,
     
    8391                this.phase = phase;
    8492                this.actions = actions;
    85                 this.connections = conns;
    8693                this.progress = progress;
    8794                this.settings = settings;
     
    9097
    9198        /**
    92          * Can be called after all connections are initialized.
    93          *
    94          * @param now current time ms since 1970
    95          *
    96          * @return state with the initial partystates set.
    97          */
    98         public MOPACState initPhase(long now) {
    99                 PartyStates partyStates = new PartyStates(getPowers());
    100                 Phase firstPhase = new OfferPhase(null, partyStates,
    101                                 now + getAvailablePhaseTime(now),
    102                                 settings.getVotingEvaluation());
    103                 return new MOPACState(firstPhase, actions, connections, progress,
    104                                 settings, partyprofiles);
    105         }
    106 
    107         @Override
    108         public List<Action> getActions() {
    109                 return Collections.unmodifiableList(actions);
    110         }
    111 
    112         @Override
    113         public Progress getProgress() {
    114                 return progress;
    115         }
    116 
    117         public Map<PartyId, PartyWithProfile> getPartyProfiles() {
    118                 return Collections.unmodifiableMap(partyprofiles);
    119         }
    120 
    121         /**
    122          * @return all current/remaining active party connections. Finished/crashed
    123          *         parties should be removed immediately.
    124          */
    125         public ProtocolToPartyConnections getConnections() {
    126                 return connections;
    127         }
    128 
    129         /**
    130          * @param now current time ms since 1970
    131          * @return the max possible duration in ms of the NEXT phase. Maybe 0 or
    132          *         negative if past deadline.
    133          */
    134         private Long getAvailablePhaseTime(long now) {
    135                 // explicit check, to check also the round counts.
    136                 if (incrementProgress().isPastDeadline(now + Phase.PHASE_MINTIME))
    137                         return 0l;
    138                 return Math.min(progress.getTerminationTime().getTime() - now,
    139                                 Phase.PHASE_MAXTIME);
    140         }
    141 
    142         /**
    143          *
    144          * @param connection   the new {@link ProtocolToPartyConn}
    145          * @param partyprofile the {@link PartyWithProfile} that is associated with
    146          *                     this state
    147          * @return new {@link MOPACState} with the new connection added. This call
    148          *         ignores the progress (does not check isFinal) because we uses
    149          *         this during the setup where the deadline is not yet relevant.
    150          */
    151         protected MOPACState with(ProtocolToPartyConn connection,
    152                         PartyWithProfile partyprofile) {
    153                 if (phase != null)
    154                         throw new IllegalStateException(
    155                                         "Adding connections only allowed while initializing");
    156 
    157                 ProtocolToPartyConnections newconns = getConnections().with(connection);
    158                 Map<PartyId, PartyWithProfile> newprofiles = new HashMap<>(
    159                                 partyprofiles);
    160                 newprofiles.put(connection.getParty(), partyprofile);
    161                 return new MOPACState(null, actions, newconns, progress, settings,
    162                                 newprofiles);
    163         }
    164 
    165         /**
    166          * @param id the {@link PartyId} of the party that failed.
    167          * @param e  the {@link ProtocolException} that occurred in the party
    168          * @return a new state with the error set.
    169          */
    170         public MOPACState with(ProtocolException e) {
    171                 return new MOPACState(phase.with(e), actions, connections, progress,
    172                                 settings, partyprofiles);
    173         }
    174 
    175         /**
    176          * Sets the progress for this session. Can be set only if progress=null.
    177          * Should be set in INIT phase.
    178          *
    179          * @param newprogress the new progress
    180          * @return new {@link MOPACState} with the progress set
    181          */
    182         public MOPACState with(Progress newprogress) {
     99         * Sets the progress for this session and initial phase. Must be called
     100         * after all parties have been connected with
     101         * {@link #with(PartyId, PartyWithProfile)}.
     102         *
     103         * @param newprogress the initial {@link Progress} typically matching the
     104         *                    settings deadline object
     105         * @param now         current time ms since 1970
     106         *
     107         * @return state with the initial partystates , progress set.
     108         */
     109        public MOPACState initPhase(Progress newprogress, long now) {
    183110                if (progress != null || newprogress == null || phase != null) {
    184111                        throw new IllegalArgumentException(
    185112                                        "progress must be null, newprogress must be not null and phase must be INIT");
    186113                }
    187                 return new MOPACState(phase, actions, connections, newprogress,
    188                                 getSettings(), partyprofiles);
     114
     115                PartyStates partyStates = new PartyStates(getPowers());
     116                Phase firstPhase = new OfferPhase(partyStates,
     117                                now + getAvailablePhaseTime(newprogress, now),
     118                                settings.getVotingEvaluation());
     119                return new MOPACState(firstPhase, actions, newprogress, settings,
     120                                partyprofiles);
     121        }
     122
     123        @Override
     124        public List<Action> getActions() {
     125                return Collections.unmodifiableList(actions);
     126        }
     127
     128        @Override
     129        public Progress getProgress() {
     130                return progress;
     131        }
     132
     133        @Override
     134        public Agreements getAgreements() {
     135                return phase.getPartyStates().getAgreements();
     136        }
     137
     138        @Override
     139        public MOPACSettings getSettings() {
     140                return settings;
     141        }
     142
     143        public Map<PartyId, PartyWithProfile> getPartyProfiles() {
     144                return Collections.unmodifiableMap(partyprofiles);
     145        }
     146
     147        @Override
     148        public boolean isFinal(long now) {
     149                return phase != null && phase.isFinal(now) && !isNewPhasePossible(now);
     150        }
     151
     152        @Override
     153        public SessionResult getResult() {
     154                return new SessionResult(partyprofiles, getAgreements(),
     155                                Collections.emptyMap(), null);
     156        }
     157
     158        /**
     159         * @param progress the Progress that needs to be checked
     160         * @param now      current time ms since 1970
     161         * @return the max possible duration in ms of a phase considering the
     162         *         progress.
     163         */
     164        private static Long getAvailablePhaseTime(Progress aprogress, long now) {
     165                return Math.min(aprogress.getTerminationTime().getTime() - now,
     166                                Phase.PHASE_MAXTIME);
     167        }
     168
     169        /**
     170         * @param id           the new {@link PartyId}
     171         * @param partyprofile the {@link PartyWithProfile} that is associated with
     172         *                     this state
     173         * @return new {@link MOPACState} with the new party added. This call
     174         *         ignores the progress (does not check isFinal) because we uses
     175         *         this during the setup where the deadline is not yet relevant.
     176         */
     177        protected MOPACState with(PartyId id, PartyWithProfile partyprofile) {
     178                if (phase != null)
     179                        throw new IllegalStateException(
     180                                        "Adding connections only allowed while initializing");
     181
     182                Map<PartyId, PartyWithProfile> newprofiles = new HashMap<>(
     183                                partyprofiles);
     184                newprofiles.put(id, partyprofile);
     185                return new MOPACState(null, actions, progress, settings, newprofiles);
     186        }
     187
     188        /**
     189         * @param e the {@link ProtocolException} that occured
     190         * @return a new state with the error set. You MUST have called
     191         *         {@link #initPhase(Progress, long)} before using this
     192         */
     193        public MOPACState with(ProtocolException e) {
     194                return new MOPACState(phase.with(e), actions, progress, settings,
     195                                partyprofiles);
    189196        }
    190197
     
    202209                                Math.min(remainingNegoTime, Phase.PHASE_MAXTIME));
    203210
    204                 return new MOPACState(newphase, actions, connections,
    205                                 incrementProgress(), getSettings(), partyprofiles);
    206         }
    207 
    208         /**
    209          *
    210          * @return the next progress. Progress round advances if phase is
    211          *         {@link OptIn}.
    212          */
    213         private Progress incrementProgress() {
    214                 if (progress instanceof ProgressRounds && phase instanceof OptInPhase)
    215                         return ((ProgressRounds) progress).advance();
    216                 return progress;
    217         }
    218 
    219         @Override
    220         public boolean isFinal(long now) {
    221                 return phase != null && phase.isFinal(now) && !isNewPhasePossible(now);
     211                return new MOPACState(newphase, actions, increment(progress, phase),
     212                                getSettings(), partyprofiles);
    222213        }
    223214
     
    225216         * When this is called, all parties should have acted.
    226217         *
    227          * @param now
    228          * @return
     218         * @param now current time
     219         * @return true if there are still &gt;2 parties active and we have enough
     220         *         time for a new phase.
    229221         */
    230222        public boolean isNewPhasePossible(long now) {
    231223                // System.out.println("phase=" + phase);
    232                 boolean a = phase.getPartyStates().getNegotiatingParties().size() >= 2
    233                                 && getAvailablePhaseTime(now) > Phase.PHASE_MINTIME;
    234                 // System.out.println("newstate possible:" + a);
    235                 return a;
    236         }
    237 
    238         @Override
    239         public Agreements getAgreements() {
    240                 return phase.getPartyStates().getAgreements();
    241         }
    242 
    243         @Override
    244         public MOPACSettings getSettings() {
    245                 return settings;
     224                Progress newprogress = increment(progress, phase);
     225                if (newprogress.isPastDeadline(now + Phase.PHASE_MINTIME))
     226                        return false;
     227
     228                return phase.getPartyStates().getNegotiatingParties().size() >= 2
     229                                && getAvailablePhaseTime(newprogress,
     230                                                now) > Phase.PHASE_MINTIME;
    246231        }
    247232
     
    261246         * @param now    the current time in ms since 1970, see
    262247         *               {@link System#currentTimeMillis()}
     248         * @return new {@link MOPACState} with the action checked and registered. If
     249         *         the action is not allowed, the new state may be that the actor is
     250         *         in the exception list.
    263251         */
    264252
    265253        public MOPACState with(PartyId actor, Action action, long now) {
    266                 return new MOPACState(phase.with(actor, action, now), actions,
    267                                 connections, progress, settings, partyprofiles);
    268         }
    269 
    270         @Override
    271         public SessionResult getResult() {
    272                 return new SessionResult(partyprofiles, getAgreements(),
    273                                 Collections.emptyMap(), null);
     254                return new MOPACState(phase.with(actor, action, now), actions, progress,
     255                                settings, partyprofiles);
     256        }
     257
     258        /**
     259         * @param aprogress the progress that might need to be advanced
     260         * @param aphase    the phase
     261         * @return the next progress. Progress round advances if phase is
     262         *         {@link OptIn}.
     263         */
     264        private static Progress increment(Progress aprogress, Phase aphase) {
     265                if (aprogress instanceof ProgressRounds && aphase instanceof OptInPhase)
     266                        return ((ProgressRounds) aprogress).advance();
     267                return aprogress;
    274268        }
    275269
     
    294288        public String toString() {
    295289                return "MOPACState[" + phase + "," + settings + "," + partyprofiles
    296                                 + "," + connections + "," + progress + "," + "]";
     290                                + "," + progress + "]";
    297291        }
    298292
     
    306300                LinkedList<Action> newactions = new LinkedList<Action>(actions);
    307301                newactions.addAll(newphase.getPartyStates().getActions());
    308                 return new MOPACState(newphase, newactions, connections, progress,
    309                                 settings, partyprofiles);
     302                return new MOPACState(newphase, newactions, progress, settings,
     303                                partyprofiles);
     304        }
     305
     306        @Override
     307        public int hashCode() {
     308                final int prime = 31;
     309                int result = 1;
     310                result = prime * result + ((actions == null) ? 0 : actions.hashCode());
     311                result = prime * result
     312                                + ((partyprofiles == null) ? 0 : partyprofiles.hashCode());
     313                result = prime * result + ((phase == null) ? 0 : phase.hashCode());
     314                result = prime * result
     315                                + ((progress == null) ? 0 : progress.hashCode());
     316                result = prime * result
     317                                + ((settings == null) ? 0 : settings.hashCode());
     318                return result;
     319        }
     320
     321        @Override
     322        public boolean equals(Object obj) {
     323                if (this == obj)
     324                        return true;
     325                if (obj == null)
     326                        return false;
     327                if (getClass() != obj.getClass())
     328                        return false;
     329                MOPACState other = (MOPACState) obj;
     330                if (actions == null) {
     331                        if (other.actions != null)
     332                                return false;
     333                } else if (!actions.equals(other.actions))
     334                        return false;
     335                if (partyprofiles == null) {
     336                        if (other.partyprofiles != null)
     337                                return false;
     338                } else if (!partyprofiles.equals(other.partyprofiles))
     339                        return false;
     340                if (phase == null) {
     341                        if (other.phase != null)
     342                                return false;
     343                } else if (!phase.equals(other.phase))
     344                        return false;
     345                if (progress == null) {
     346                        if (other.progress != null)
     347                                return false;
     348                } else if (!progress.equals(other.progress))
     349                        return false;
     350                if (settings == null) {
     351                        if (other.settings != null)
     352                                return false;
     353                } else if (!settings.equals(other.settings))
     354                        return false;
     355                return true;
    310356        }
    311357
  • protocol/src/main/java/geniusweb/protocol/session/mopac/PartyStates.java

    r21 r24  
    11package geniusweb.protocol.session.mopac;
    22
    3 import java.util.Arrays;
    4 import java.util.Collection;
    53import java.util.Collections;
    64import java.util.HashMap;
     
    1210import java.util.stream.Collectors;
    1311
     12import com.fasterxml.jackson.annotation.JsonAutoDetect;
     13import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
     14import com.fasterxml.jackson.annotation.JsonCreator;
     15import com.fasterxml.jackson.annotation.JsonProperty;
     16
    1417import geniusweb.actions.Action;
    1518import geniusweb.actions.EndNegotiation;
     
    1922
    2023/**
    21  * The current state of all participating parties. A party either notYetActed,
    22  * did action, reached an agreement, walked away or made a
     24 * Invariant: contains the current state of all participating parties. A party
     25 * either notYetActed, did action, reached an agreement, walked away or made a
    2326 * {@link ProtocolException}.
    2427 * <p>
     
    2629 * agreements and move remaining parties back to notYetActed.
    2730 *
    28  * This is not considering current time or checking actions.
    2931 */
     32@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE)
    3033public class PartyStates {
    3134        // all parties must be in exactly one state at all times.
     
    3538        private final List<PartyId> walkedAway;
    3639        private final Map<PartyId, ProtocolException> exceptions;
    37         private Map<PartyId, Integer> powers;
     40        private final Map<PartyId, Integer> powers;
     41
     42        @JsonCreator
     43        protected PartyStates(@JsonProperty("notYetActed") Set<PartyId> notYetActed,
     44                        @JsonProperty("actions") List<Action> actions,
     45                        @JsonProperty("agreements") Agreements agreements,
     46                        @JsonProperty("walkedAway") List<PartyId> walkedAway,
     47                        @JsonProperty("exceptions") Map<PartyId, ProtocolException> exceptions,
     48                        @JsonProperty("powers") Map<PartyId, Integer> powers) {
     49                this.notYetActed = notYetActed;
     50                this.actions = actions;
     51                this.agreements = agreements;
     52                this.walkedAway = walkedAway;
     53                this.exceptions = exceptions;
     54                this.powers = powers;
     55        }
    3856
    3957        /**
     
    5169        }
    5270
    53         public PartyStates(Set<PartyId> notYetActed, List<Action> actions,
    54                         Agreements agreements, List<PartyId> walkedAway,
    55                         Map<PartyId, ProtocolException> exceptions,
    56                         Map<PartyId, Integer> powers) {
    57                 this.notYetActed = notYetActed;
    58                 this.actions = actions;
    59                 this.agreements = agreements;
    60                 this.walkedAway = walkedAway;
    61                 this.exceptions = exceptions;
    62                 this.powers = powers;
    63         }
    64 
    65         /**
    66          *
    67          * @param action
    68          * @return new state with party done given action.
     71        /**
     72         *
     73         * @param action the action done by some party. The correctness of action,
     74         *               particularly of {@link Action#getActor()}, must be correct.
     75         * @return new state with party done given action. This just accepts any
     76         *         given action and is not considering number of rounds, time or
     77         *         whether an action is allowed.
     78         *
    6979         * @throws IllegalArgumentException if party doing action already acted.
    7080         *                                  This is just a safety check as legality
     
    151161
    152162        /**
    153          *
    154163         * @param actor
    155164         * @return {@link #notYetActed} with actor removed
    156          */
    157         private Set<PartyId> removeParty(PartyId actor) {
    158                 return removeParties(new HashSet<>(Arrays.asList(actor)));
     165         * @throws IllegalArgumentException if party already acted (not in
     166         *                                  {@link #notYetActed}).
     167         */
     168        private Set<PartyId> removeParty(PartyId party) {
     169                Set<PartyId> newActiveParties = new HashSet<>(notYetActed);
     170                if (!newActiveParties.remove(party))
     171                        throw new IllegalArgumentException(
     172                                        "Party " + party + " is not active, can't be removed");
     173                return newActiveParties;
     174
    159175        }
    160176
     
    169185        public Map<PartyId, ProtocolException> getExceptions() {
    170186                return Collections.unmodifiableMap(exceptions);
    171         }
    172 
    173         /**
    174          *
    175          * @param parties the parties to remove
    176          * @return {@link #notYetActed} without the given parties.
    177          */
    178         private Set<PartyId> removeParties(Collection<PartyId> parties) {
    179                 Set<PartyId> newActiveParties = new HashSet<>(notYetActed);
    180                 for (PartyId party : parties) {
    181                         if (!newActiveParties.remove(party))
    182                                 throw new IllegalArgumentException(
    183                                                 "Party " + party + " is not active, can't be removed");
    184                 }
    185                 return newActiveParties;
    186187        }
    187188
     
    204205
    205206        /**
    206          * @param type the type of actions to extract
     207         *
     208         * @return all parties that walked away
     209         */
     210        public List<PartyId> getWalkedAway() {
     211                return walkedAway;
     212        }
     213
     214        /**
     215         * @param <T>  the type of objects requested
     216         * @param type the type of actions to extract. Must be of type T, needed
     217         *             because of java's type erasure.
     218         *
    207219         * @return all actions of type done in this phase
    208220         */
     
    233245        }
    234246
     247        @Override
     248        public int hashCode() {
     249                final int prime = 31;
     250                int result = 1;
     251                result = prime * result + ((actions == null) ? 0 : actions.hashCode());
     252                result = prime * result
     253                                + ((agreements == null) ? 0 : agreements.hashCode());
     254                result = prime * result
     255                                + ((exceptions == null) ? 0 : exceptions.hashCode());
     256                result = prime * result
     257                                + ((notYetActed == null) ? 0 : notYetActed.hashCode());
     258                result = prime * result + ((powers == null) ? 0 : powers.hashCode());
     259                result = prime * result
     260                                + ((walkedAway == null) ? 0 : walkedAway.hashCode());
     261                return result;
     262        }
     263
     264        @Override
     265        public boolean equals(Object obj) {
     266                if (this == obj)
     267                        return true;
     268                if (obj == null)
     269                        return false;
     270                if (getClass() != obj.getClass())
     271                        return false;
     272                PartyStates other = (PartyStates) obj;
     273                if (actions == null) {
     274                        if (other.actions != null)
     275                                return false;
     276                } else if (!actions.equals(other.actions))
     277                        return false;
     278                if (agreements == null) {
     279                        if (other.agreements != null)
     280                                return false;
     281                } else if (!agreements.equals(other.agreements))
     282                        return false;
     283                if (exceptions == null) {
     284                        if (other.exceptions != null)
     285                                return false;
     286                } else if (!exceptions.equals(other.exceptions))
     287                        return false;
     288                if (notYetActed == null) {
     289                        if (other.notYetActed != null)
     290                                return false;
     291                } else if (!notYetActed.equals(other.notYetActed))
     292                        return false;
     293                if (powers == null) {
     294                        if (other.powers != null)
     295                                return false;
     296                } else if (!powers.equals(other.powers))
     297                        return false;
     298                if (walkedAway == null) {
     299                        if (other.walkedAway != null)
     300                                return false;
     301                } else if (!walkedAway.equals(other.walkedAway))
     302                        return false;
     303                return true;
     304        }
     305
    235306}
  • protocol/src/main/java/geniusweb/protocol/session/mopac/phase/DefaultPhase.java

    r23 r24  
    11package geniusweb.protocol.session.mopac.phase;
    2 
    3 import java.util.List;
    4 import java.util.stream.Collectors;
    5 
    6 import com.fasterxml.jackson.annotation.JsonIgnore;
    72
    83import geniusweb.actions.Action;
    94import geniusweb.actions.PartyId;
    10 import geniusweb.actions.Votes;
    115import geniusweb.protocol.ProtocolException;
    126import geniusweb.protocol.session.mopac.PartyStates;
     
    1711        protected final Long deadline;
    1812        protected final PartyStates partyStates;
    19 
    20         // don't serialize this, users don't need it..
    21         @JsonIgnore
    2213        protected final VotingEvaluator evaluator;
    2314
    24         // don't serialize this, it will cause very large file
    25         @JsonIgnore
    26         protected final Phase prevPhase;
    27 
    2815        /**
    29          *
    30          * @param actions     the actions done in this phase .
    31          * @param prevPhase   the previous phase, can be used to collect previous
    32          *                    votes etc.
    33          * @param partyStates
     16         * @param partyStates the {@link PartyStates}
    3417         * @param deadline    deadline for this phase, ms since 1970
     18         * @param evaluator   the {@link VotingEvaluator} to be used
    3519         */
    36         public DefaultPhase(Phase prevPhase, PartyStates partyStates, Long deadline,
     20        public DefaultPhase(PartyStates partyStates, Long deadline,
    3721                        VotingEvaluator evaluator) {
    3822                this.partyStates = partyStates;
    3923                this.deadline = deadline;
    40                 this.prevPhase = prevPhase;
    4124                this.evaluator = evaluator;
    4225        }
     
    5336
    5437        /**
    55          * @return all votes done in this phase.
    56          */
    57         public List<Votes> getVotes() {
    58                 return partyStates.getActions().stream()
    59                                 .filter(act -> act instanceof Votes).map(act -> (Votes) act)
    60                                 .collect(Collectors.toList());
    61         }
    62 
    63         /**
    6438         * Check if actor can do given action. Basic checks:
    6539         * <ul>
     
    7044         * </ul>
    7145         *
    72          * @param activeParties the currently active parties
    73          * @param actor
    74          * @param action
    75          * @param timems
    76          * @throws ProtocolException
    77          * @throw ProtocolException if the action violates the protocol, or null if
    78          *        ok
     46         * @param actor  the actor that really acted
     47         * @param action the action that was done
     48         * @param now    current time
     49         * @throws ProtocolException if the action violates the protocol
    7950         */
    80         protected void checkAction(PartyId actor, Action action, long timems)
     51        protected void checkAction(PartyId actor, Action action, long now)
    8152                        throws ProtocolException {
    8253                if (action == null)
     
    8657                                        "Incorrect actor info in action:" + action.getActor(),
    8758                                        actor);
    88                 if (isFinal(timems))
     59                if (isFinal(now))
    8960                        throw new ProtocolException("passed deadline", actor);
    9061                if (!(getAllowedActions().contains(action.getClass())))
    91                         throw new ProtocolException(
    92                                         "Action not allowed in " + this.getClass() + ":" + action,
    93                                         actor);
     62                        throw new ProtocolException("Action not allowed in "
     63                                        + this.getClass().getSimpleName() + ": " + action, actor);
    9464                if (!partyStates.getNotYetActed().contains(actor))
    9565                        throw new ProtocolException("Actor can not act anymore", actor);
     
    9868
    9969        /**
    100          * @param timems current time
    10170         * @return current PartyStates
    10271         */
     
    11685                        throw new IllegalArgumentException("Bug, illegal duration");
    11786                if (!isFinal(now))
    118                         throw new IllegalStateException(
    119                                         "next must only be called when phase isFinal");
    120                 if (!partyStates.getNotYetActed().isEmpty())
    121                         throw new IllegalStateException("Bug. State has not been finished");
     87                        throw new IllegalStateException("phase is not final");
    12288                return checkedNext(now + duration);
    12389        }
    12490
    12591        /**
     92         * As {@link #next(long, long)} but DefaultPhase already checked that 1.
     93         * there is enough time for a next phase 2. current state is final 3.
    12694         *
    127          * @param deadline
     95         * @param dl the deadline for the next phase (ms since 1970).
    12896         * @return the next phase
    12997         */
    130         protected abstract Phase checkedNext(long deadline);
     98        protected abstract Phase checkedNext(long dl);
    13199
    132100        @Override
    133101        public String toString() {
    134                 // don't print prev state, it will give HUGE list because it also
    135                 // contains prevstate.....
    136102                return getClass().getSimpleName() + "[" + partyStates + "," + deadline
    137103                                + "," + evaluator + "]";
    138104        }
     105
     106        @Override
     107        public int hashCode() {
     108                final int prime = 31;
     109                int result = 1;
     110                result = prime * result
     111                                + ((deadline == null) ? 0 : deadline.hashCode());
     112                result = prime * result
     113                                + ((evaluator == null) ? 0 : evaluator.hashCode());
     114                result = prime * result
     115                                + ((partyStates == null) ? 0 : partyStates.hashCode());
     116                return result;
     117        }
     118
     119        @Override
     120        public boolean equals(Object obj) {
     121                if (this == obj)
     122                        return true;
     123                if (obj == null)
     124                        return false;
     125                if (getClass() != obj.getClass())
     126                        return false;
     127                DefaultPhase other = (DefaultPhase) obj;
     128                if (deadline == null) {
     129                        if (other.deadline != null)
     130                                return false;
     131                } else if (!deadline.equals(other.deadline))
     132                        return false;
     133                if (evaluator == null) {
     134                        if (other.evaluator != null)
     135                                return false;
     136                } else if (!evaluator.equals(other.evaluator))
     137                        return false;
     138                if (partyStates == null) {
     139                        if (other.partyStates != null)
     140                                return false;
     141                } else if (!partyStates.equals(other.partyStates))
     142                        return false;
     143                return true;
     144        }
    139145}
  • protocol/src/main/java/geniusweb/protocol/session/mopac/phase/OfferPhase.java

    r23 r24  
    44import java.util.List;
    55import java.util.stream.Collectors;
     6
     7import com.fasterxml.jackson.annotation.JsonCreator;
     8import com.fasterxml.jackson.annotation.JsonProperty;
    69
    710import geniusweb.actions.Action;
     
    1821public class OfferPhase extends DefaultPhase {
    1922
    20         public OfferPhase(Phase prevPhase, PartyStates partyStates, Long deadlinems,
    21                         VotingEvaluator evaluator) {
    22                 super(prevPhase, partyStates, deadlinems, evaluator);
     23        @JsonCreator
     24        public OfferPhase(@JsonProperty("partyStates") PartyStates partyStates,
     25                        @JsonProperty("deadlinems") Long deadlinems,
     26                        @JsonProperty("evaluator") VotingEvaluator evaluator) {
     27                super(partyStates, deadlinems, evaluator);
    2328        }
    2429
     
    3035                        return this.with(ex);
    3136                }
    32                 return new OfferPhase(prevPhase, partyStates.with(action), deadline,
    33                                 evaluator);
     37                return new OfferPhase(partyStates.with(action), deadline, evaluator);
    3438        }
    3539
     
    4246        public OfferPhase with(ProtocolException e) {
    4347                System.out.println("Party kicked because of protocol exception:" + e);
    44                 return new OfferPhase(prevPhase, partyStates.with(e), deadline,
    45                                 evaluator);
     48                return new OfferPhase(partyStates.with(e), deadline, evaluator);
    4649        }
    4750
    4851        @Override
    4952        public Phase finish() {
    50                 return new OfferPhase(prevPhase, partyStates.finish(), deadline,
    51                                 evaluator);
     53                return new OfferPhase(partyStates.finish(), deadline, evaluator);
    5254        }
    5355
    5456        @Override
    5557        public VotingPhase checkedNext(long deadln) {
    56                 return new VotingPhase(this, partyStates.flush(), deadln, evaluator);
     58                return new VotingPhase(getOffers(), partyStates.flush(), deadln,
     59                                evaluator);
    5760        }
    5861
    59         public List<Bid> getOffers() {
     62        protected List<Bid> getOffers() {
    6063                return partyStates.getActions(Offer.class).stream()
    6164                                .map(offer -> offer.getBid()).collect(Collectors.toList());
  • protocol/src/main/java/geniusweb/protocol/session/mopac/phase/OptInPhase.java

    r23 r24  
    55import java.util.Map;
    66import java.util.stream.Collectors;
     7
     8import com.fasterxml.jackson.annotation.JsonCreator;
     9import com.fasterxml.jackson.annotation.JsonProperty;
    710
    811import geniusweb.actions.Action;
     
    2023public class OptInPhase extends DefaultPhase {
    2124
    22         protected OptInPhase(Phase prevPhase, PartyStates partyStates,
    23                         Long deadlinems, VotingEvaluator evaluator) {
    24                 super(prevPhase, partyStates, deadlinems, evaluator);
     25        /**
     26         * The votes received in the {@link VotingPhase}
     27         */
     28        private final List<Votes> votes;
     29
     30        @JsonCreator
     31        protected OptInPhase(@JsonProperty("votes") List<Votes> votes,
     32                        @JsonProperty("partyStates") PartyStates partyStates,
     33                        @JsonProperty("deadlinems") Long deadlinems,
     34                        @JsonProperty("evaluator") VotingEvaluator evaluator) {
     35                super(partyStates, deadlinems, evaluator);
     36                this.votes = votes;
    2537        }
    2638
    2739        @Override
    2840        public Inform getInform() {
    29                 return new OptIn(((VotingPhase) prevPhase).getVotes());
     41                return new OptIn(votes);
    3042        }
    3143
     
    3547                        checkAction(actor, action, now);
    3648                        if (action instanceof Votes)
    37                                 checkExtends(action);
     49                                checkExtends((Votes) action);
    3850
    39                         return new OptInPhase(prevPhase, partyStates.with(action), deadline,
     51                        return new OptInPhase(votes, partyStates.with(action), deadline,
    4052                                        evaluator);
    4153
     
    4860         * Check that this action extends previous action.
    4961         *
    50          * @param action
    51          * @param phase
     62         * @param newvotes new {@link Votes} just received
    5263         * @throws ProtocolException if this action does not correctly extend
    5364         *                           previous vote.
    5465         */
    55         private void checkExtends(Action action) throws ProtocolException {
    56 
    57                 Votes votes = (Votes) action;
    58                 PartyId actor = action.getActor();
     66        private void checkExtends(Votes newvotes) throws ProtocolException {
     67                PartyId actor = newvotes.getActor();
    5968                // this actor is active so he must have voted in previous round.
    60                 Votes prevVotes = ((VotingPhase) prevPhase).getVotes().stream()
    61                                 .filter(v -> v.getActor().equals(actor)).findFirst().get();
    62                 if (!(votes.isExtending(prevVotes)))
    63                         throw new ProtocolException("New votes " + action
     69                Votes prevVotes = votes.stream().filter(v -> v.getActor().equals(actor))
     70                                .findFirst().get();
     71                if (!(newvotes.isExtending(prevVotes)))
     72                        throw new ProtocolException("New votes " + newvotes
    6473                                        + " does not extend previous vote " + prevVotes, actor);
    6574        }
     
    6776        @Override
    6877        public OptInPhase with(ProtocolException e) {
    69                 return new OptInPhase(prevPhase, partyStates.with(e), deadline,
    70                                 evaluator);
     78                return new OptInPhase(votes, partyStates.with(e), deadline, evaluator);
    7179        }
    7280
     
    8492                PartyStates finalStates = states.with(newAgree);
    8593
    86                 return new OptInPhase(prevPhase, finalStates, deadline, evaluator);
     94                return new OptInPhase(votes, finalStates, deadline, evaluator);
    8795        }
    8896
    8997        @Override
    9098        public OfferPhase checkedNext(long newdeadline) {
    91                 return new OfferPhase(this, partyStates.flush(), newdeadline,
    92                                 evaluator);
     99                return new OfferPhase(partyStates.flush(), newdeadline, evaluator);
    93100        }
    94101
  • protocol/src/main/java/geniusweb/protocol/session/mopac/phase/Phase.java

    r23 r24  
    22
    33import java.util.List;
    4 import java.util.Set;
    54
    65import com.fasterxml.jackson.annotation.JsonAutoDetect;
    76import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
     7import com.fasterxml.jackson.annotation.JsonSubTypes;
     8import com.fasterxml.jackson.annotation.JsonTypeInfo;
    89
    910import geniusweb.actions.Action;
     
    1718 * A Phase is a part of the round structure. In each round parties have to take
    1819 * multiple actions. Each action is part of a phase.
    19  *
     20 *
     21 * Invariant: A phase object handles negotiation events, ensuring that the
     22 * events are handled according to the possible actions in this phase. A phase
     23 * object must always remain in a consistent state. It does so by modifying the
     24 * contained {@link PartyStates} as needed.
     25 * <p>
     26 * The standard exception handling is assumed: unchecked exceptions are thrown
     27 * only if there is a bug in the protocol. Because none of the functions in this
     28 * interface throws, any error must be either ignored or the party must be
     29 * kicked.
    2030 */
    21 @JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
     31@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
     32@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE)
     33@JsonSubTypes({ @JsonSubTypes.Type(value = OfferPhase.class),
     34                @JsonSubTypes.Type(value = OptInPhase.class),
     35                @JsonSubTypes.Type(value = VotingPhase.class) })
    2236public interface Phase {
    2337        public static final Long PHASE_MAXTIME = 30000l; // 30sec
     
    2842         * handled by updating the PartyStates
    2943         *
    30          * @param prevPhases the list of all previous phases
    31          * @param actor      the real actor
    32          * @param action     the action submitted by actor, which this phase can
    33          *                   really handle.
    34          * @param now        the current time
     44         * @param actor  the real actor (may differ from the actor contained in the
     45         *               action)
     46         * @param action the action submitted by actor, which this phase can really
     47         *               handle.
     48         * @param now    the current time
    3549         * @return new VotingPhase
    3650         */
     
    7387         * after {@link #finish()}
    7488         *
    75          * @param now      the curren time
    76          * @param duration the max duration of the next phase. Must be between
     89         * @param now      the current time
     90         * @param duration the max duration (ms) of the next phase. Must be between
    7791         *                 {@link #PHASE_MINTIME} and {@link #PHASE_MAXTIME}. Also
    7892         *                 make sure that now+duration is at most at the total
     
    8397
    8498        /**
    85          * Get the voting evaluator
    86          *
    87          * @return
     99         * @return the voting evaluator
    88100         */
    89101        public VotingEvaluator getEvaluator();
     
    97109
    98110        /**
    99          * @param now the current time
    100          *
    101111         * @return the party states. Notice that someone must call
    102          *         {@link PartyStates#finish(Set)} if passed the deadline.
     112         *         {@link PartyStates#finish()} if passed the deadline.
    103113         */
    104114        public PartyStates getPartyStates();
  • protocol/src/main/java/geniusweb/protocol/session/mopac/phase/VotingPhase.java

    r23 r24  
    33import java.util.Arrays;
    44import java.util.List;
     5import java.util.stream.Collectors;
     6
     7import com.fasterxml.jackson.annotation.JsonCreator;
     8import com.fasterxml.jackson.annotation.JsonProperty;
    59
    610import geniusweb.actions.Action;
     
    1014import geniusweb.inform.Inform;
    1115import geniusweb.inform.Voting;
     16import geniusweb.issuevalue.Bid;
    1217import geniusweb.protocol.ProtocolException;
    1318import geniusweb.protocol.session.mopac.PartyStates;
     
    1621public class VotingPhase extends DefaultPhase {
    1722
    18         VotingPhase(Phase prevPhase, PartyStates partyStates, Long deadlinems,
    19                         VotingEvaluator evaluator) {
    20                 super(prevPhase, partyStates, deadlinems, evaluator);
     23        /**
     24         * the offers received in the {@link OfferPhase}
     25         */
     26        private final List<Bid> offers;
     27
     28        @JsonCreator
     29        protected VotingPhase(@JsonProperty("offers") List<Bid> offers,
     30                        @JsonProperty("partyStates") PartyStates partyStates,
     31                        @JsonProperty("deadlinems") Long deadlinems,
     32                        @JsonProperty("evaluator") VotingEvaluator evaluator) {
     33                super(partyStates, deadlinems, evaluator);
     34                this.offers = offers;
    2135        }
    2236
     
    2842                        return this.with(ex);
    2943                }
    30                 return new VotingPhase(prevPhase, partyStates.with(action), deadline,
     44                return new VotingPhase(offers, partyStates.with(action), deadline,
    3145                                evaluator);
    3246        }
     
    3448        @Override
    3549        public Inform getInform() {
    36                 return new Voting(((OfferPhase) prevPhase).getOffers(),
    37                                 partyStates.getPowers());
     50                return new Voting(offers, partyStates.getPowers());
    3851        }
    3952
    4053        @Override
    4154        public VotingPhase with(ProtocolException e) {
    42                 return new VotingPhase(prevPhase, partyStates.with(e), deadline,
     55                return new VotingPhase(offers, partyStates.with(e), deadline,
    4356                                evaluator);
    4457        }
     
    4659        @Override
    4760        public VotingPhase finish() {
    48                 return new VotingPhase(prevPhase, partyStates.finish(), deadline,
     61                return new VotingPhase(offers, partyStates.finish(), deadline,
    4962                                evaluator);
    5063        }
     
    5265        @Override
    5366        protected Phase checkedNext(long deadln) {
    54                 return new OptInPhase(this, partyStates.flush(), deadln, evaluator);
     67                return new OptInPhase(getVotes(), partyStates.flush(), deadln,
     68                                evaluator);
    5569        }
    5670
     
    6074        }
    6175
     76        /**
     77         * @return all votes done in this phase.
     78         */
     79        public List<Votes> getVotes() {
     80                return partyStates.getActions().stream()
     81                                .filter(act -> act instanceof Votes).map(act -> (Votes) act)
     82                                .collect(Collectors.toList());
     83        }
     84
    6285}
  • protocol/src/main/java/geniusweb/protocol/session/saop/SAOP.java

    r21 r24  
    3838
    3939/**
    40  *
    41  * All parties are first sent the {@link SessionSettings}. Only parties
    42  * specified initially in the settings do participate.
     40 * The protocol runs as follows
    4341 * <ol>
    44  * The protocol tries to start all parties. If not all parties start, the
     42 * <li>The protocol tries to start all parties. If not all parties start, the
    4543 * parties are freed up and another attempt is done to start all parties some
    4644 * time later.
     45 * <li>All parties are sent the {@link SessionSettings}. Only parties specified
     46 * initially in the settings do participate.
    4747 * <li>The session deadline clock now starts ticking.
    4848 * <li>All parties are sent their settings.
     
    6161 * the protocol.
    6262 * <p>
    63  * Threadsafe: all entrypoints are synhronized.
     63 * Thread safe: all entry points are synchronized.
    6464 */
    6565public class SAOP extends DefaultListenable<ProtocolEvent>
     
    7979        /**
    8080         *
    81          * @param state normally the initial state coming from SAOPSettings
     81         * @param state  normally the initial state coming from SAOPSettings
     82         * @param logger the Reporter to log to
    8283         */
    8384        public SAOP(SAOPState state, Reporter logger) {
  • protocol/src/main/java/geniusweb/protocol/session/saop/SAOPSettings.java

    r21 r24  
    2727         *                     protocol. But SAOP can be initialized with less, for
    2828         *                     use in TournamentSettings.
    29          * @param deadline
     29         * @param deadline     the deadline of the negotiation
    3030         */
    3131        @JsonCreator
  • protocol/src/main/java/geniusweb/protocol/session/saop/SAOPState.java

    r23 r24  
    3333        /**
    3434         *
    35          * @param actions
     35         * @param actions       the actions done by the parties
    3636         * @param conns         the existing party connections. we assume ownership
    3737         *                      of this so it should not be modified although
     
    8888        /**
    8989         *
    90          * @param e             the error that occured
    91          * @param currentTimeMs the current time in ms since 1970, see
    92          *                      {@link System#currentTimeMillis()}
     90         * @param e the error that occured
    9391         * @return a new state with the error set.
    9492         */
     
    160158
    161159        /**
    162          * @param actor         the actor that did this action. Can be used to check
    163          *                      if action is valid. NOTICE caller has to make sure
    164          *                      the current state is not final.
    165          * @param action        the action that was proposed by actor.
    166          * @param currentTimeMs the current time in ms since 1970, see
    167          *                      {@link System#currentTimeMillis()}
    168          * @return new SessionState with the action added as last action.
     160         * @param actor  the actor that did this action. Can be used to check if
     161         *               action is valid. NOTICE caller has to make sure the current
     162         *               state is not final.
     163         * @param action the action that was proposed by actor.
     164         * @return new SAOPState with the action added as last action.
    169165         */
    170166
  • protocol/src/main/java/geniusweb/protocol/session/shaop/BareSHAOPState.java

    r23 r24  
    4444        /**
    4545         *
    46          * @param actions    value for actions done so far. null equals to empty
    47          *                   list
    48          * @param conns      the currently existing connections. Can be empty/null.
    49          *                   Each connection represents another party. Normally the
    50          *                   connections are in the order SHAOP1,COB1,SHAOP2,COB2,..
    51          *                   so 2 parties for each team. The protocol should check
    52          *                   this.
    53          * @param progr      the {@link Progress} that governs this session. Can be
    54          *                   null if session did not yet start.
    55          * @param settings   the settings used for the session
    56          * @param e          the exception that occured, usually null. All errors
    57          *                   occuring due to faulty {@link Action}s translate to
    58          *                   {@link ProtocolException}s. All errors in our own code
    59          *                   are bugs (not ProtocolExceptions) and should result in
    60          *                   a throw.
    61          * @param teamNr     the teamnr (0,1,2..) that has the turn. 2* gives index
    62          *                   {@link #connections} and settings
    63          * @param partyNrs   a map for each known PartyId to a number. The number is
    64          *                   the index in both {@link SHAOPSettings#getTeams()} and
    65          *                   in {@link #connections}. null is empyt map.
    66          * @param totalSpent total accumulated elicitation costs so far. only SHAOP
    67          *                   parties accumulate costs. null = empty map
     46         * @param actions  value for actions done so far. null equals to empty list
     47         * @param conns    the currently existing connections. Can be empty/null.
     48         *                 Each connection represents another party. Normally the
     49         *                 connections are in the order SHAOP1,COB1,SHAOP2,COB2,..
     50         *                 so 2 parties for each team. The protocol should check
     51         *                 this.
     52         * @param progr    the {@link Progress} that governs this session. Can be
     53         *                 null if session did not yet start.
     54         * @param settings the settings used for the session
     55         * @param e        the exception that occured, usually null. All errors
     56         *                 occuring due to faulty {@link Action}s translate to
     57         *                 {@link ProtocolException}s. All errors in our own code
     58         *                 are bugs (not ProtocolExceptions) and should result in a
     59         *                 throw.
     60         * @param teamNr   the teamnr (0,1,2..) that has the turn. 2* gives index
     61         *                 {@link #connections} and settings
     62         * @param partyNrs a map for each known PartyId to a number. The number is
     63         *                 the index in both {@link SHAOPSettings#getTeams()} and in
     64         *                 {@link #connections}. null is empyt map.
     65         * @param spent    total accumulated elicitation costs so far for each
     66         *                 party. only SHAOP parties accumulate costs. null = empty
     67         *                 map
    6868         */
    6969        @JsonCreator
  • protocol/src/main/java/geniusweb/protocol/session/shaop/SHAOP.java

    r21 r24  
    8585        /**
    8686         *
    87          * @param state normally the initial state coming from SAOPSettings
     87         * @param state  normally the initial state coming from SAOPSettings
     88         * @param logger the {@link Reporter} to use
    8889         */
    8990        public SHAOP(SHAOPState state, Reporter logger) {
  • protocol/src/main/java/geniusweb/protocol/session/shaop/SHAOPState.java

    r21 r24  
    3838         * see {@link BareSHAOPState}.
    3939         */
     40        /**
     41         *
     42         * @param actions       see
     43         *                      {@link BareSHAOPState#BareSHAOPState(List, ProtocolToPartyConnections, Progress, SHAOPSettings, ProtocolException, int, Map, Map)}.
     44         * @param conns         see
     45         *                      {@link BareSHAOPState#BareSHAOPState(List, ProtocolToPartyConnections, Progress, SHAOPSettings, ProtocolException, int, Map, Map)}.
     46         * @param progress      see
     47         *                      {@link BareSHAOPState#BareSHAOPState(List, ProtocolToPartyConnections, Progress, SHAOPSettings, ProtocolException, int, Map, Map)}.
     48         * @param settings      see
     49         *                      {@link BareSHAOPState#BareSHAOPState(List, ProtocolToPartyConnections, Progress, SHAOPSettings, ProtocolException, int, Map, Map)}.
     50         * @param e             see
     51         *                      {@link BareSHAOPState#BareSHAOPState(List, ProtocolToPartyConnections, Progress, SHAOPSettings, ProtocolException, int, Map, Map)}.
     52         * @param teamNr        see
     53         *                      {@link BareSHAOPState#BareSHAOPState(List, ProtocolToPartyConnections, Progress, SHAOPSettings, ProtocolException, int, Map, Map)}.
     54         * @param partytNumbers see
     55         *                      {@link BareSHAOPState#BareSHAOPState(List, ProtocolToPartyConnections, Progress, SHAOPSettings, ProtocolException, int, Map, Map)}.
     56         * @param spent         see
     57         *                      {@link BareSHAOPState#BareSHAOPState(List, ProtocolToPartyConnections, Progress, SHAOPSettings, ProtocolException, int, Map, Map)}.
     58         */
    4059        @JsonCreator
    4160        public SHAOPState(@JsonProperty("actions") List<Action> actions,
     
    7291        /**
    7392         *
    74          * @param party
    75          * @return true iff party is a SHAOP party.
     93         * @param party the {@link PartyId} to test
     94         * @return true iff party is a SHAOP party (not a COB party).
    7695         */
    7796        public boolean isShaopParty(PartyId party) {
     
    81100        /**
    82101         *
    83          * @return the team leader {@link PartyId}s.
     102         * @return the team leader {@link PartyId}s which are the SHAOP parties.
    84103         */
    85104        private Set<PartyId> getLeaders() {
     
    149168        /**
    150169         *
    151          * @param e             the error that occured
    152          * @param currentTimeMs the current time in ms since 1970, see
    153          *                      {@link System#currentTimeMillis()}
     170         * @param e the error that occured
    154171         * @return a new state with the error set.
    155172         */
     
    201218
    202219        /**
    203          * @param actor         the actor that did this action. Can be used to check
    204          *                      if action is valid. NOTICE caller has to make sure
    205          *                      the current state is not final.
    206          * @param action        the action that was proposed by actor.
    207          * @param currentTimeMs the current time in ms since 1970, see
    208          *                      {@link System#currentTimeMillis()}
     220         * @param actor  the actor that did this action. Can be used to check if
     221         *               action is valid. NOTICE caller has to make sure the current
     222         *               state is not final.
     223         * @param action the action that was proposed by actor.
    209224         * @return new SessionState with the action added as last action.
    210225         */
  • protocol/src/main/java/geniusweb/protocol/tournament/allpermutations/AllPermutationsProtocol.java

    r20 r24  
    3434        /**
    3535         *
    36          * @param state
     36         * @param state  the {@link AllPermutationsState}
    3737         * @param logger used for all logging, about the tournament, and the created
    3838         *               the session and protocols.
     
    8181                        long now = System.currentTimeMillis();
    8282                        if (sessionstate.isFinal(now)) {
    83                                 // List<TeamOfPartiesAndProfiles> participants =
    84                                 // sessionstate.getSettings().getParticipants()
    8583                                SessionResult result = sessionstate.getResult();
    8684                                state = state.with(result);
  • protocol/src/main/java/geniusweb/protocol/tournament/allpermutations/AllPermutationsSettings.java

    r21 r24  
    6969        /**
    7070         *
    71          * @param teams             a list of {@link Team}s. Must contain at least
    72          *                          {@link #teamsPerSession} elements. The
    73          *                          <teamsize> must match the protocol: (SAOP:1,
    74          *                          SHAOP:2)
    75          * @param reuseTeams        if true, we use PermutationsWithReturn, if false
    76          *                          we use PermutationsWithoutReturn to create the
    77          *                          teams.
    78          * @param plists            list of available {@link ProfileList}s to be
    79          *                          permutated over the teams. Each
    80          *                          {@link ProfileList} must contain <teamsize>
    81          *                          elements.
    82          * @param teamsPerSession   number of parties per session, must be at least
    83          *                          2.
    84          * @param sesettings        The generic {@link SessionSetting}.
    85          *                          {@link SessionSettings#with(PartyWithProfile)}
    86          *                          will be used to add the required
    87          *                          {@link PartyWithProfile}s
    88          * @param numberTournaments the number of times the tournament should be
    89          *                          run.
     71         * @param teams           a list of {@link Team}s. Must contain at least
     72         *                        {@link #teamsPerSession} elements. The
     73         *                        {@link #teamsPerSession} must match the protocol:
     74         *                        (SAOP:1, SHAOP:2)
     75         * @param reuseTeams      if true, we use PermutationsWithReturn, if false
     76         *                        we use PermutationsWithoutReturn to create the
     77         *                        teams.
     78         * @param plists          list of available {@link ProfileList}s to be
     79         *                        permutated over the teams. Each
     80         *                        {@link ProfileList} must contain
     81         *                        {@link #teamsPerSession} elements.
     82         * @param teamsPerSession number of parties per session, must be at least 2.
     83         * @param sesettings      The generic {@link SessionSettings}.
     84         *                        {@link SessionSettings#with(TeamOfPartiesAndProfiles)}
     85         *                        will be used to add the required
     86         *                        {@link TeamOfPartiesAndProfiles}s
     87         * @param nTournaments    the number of times the tournament should be run.
    9088         */
    9189        @JsonCreator
  • protocol/src/test/java/geniusweb/protocol/session/mopac/MOPACTest.java

    r21 r24  
    22
    33import static org.junit.Assert.assertEquals;
     4import static org.junit.Assert.assertFalse;
    45import static org.junit.Assert.assertNotNull;
    56import static org.junit.Assert.assertTrue;
    67import static org.mockito.Matchers.any;
     8import static org.mockito.Matchers.anyLong;
    79import static org.mockito.Mockito.mock;
    810import static org.mockito.Mockito.times;
     
    1214import java.io.IOException;
    1315import java.util.Arrays;
     16import java.util.Date;
    1417import java.util.List;
    1518
    1619import org.junit.Before;
    17 import org.junit.Ignore;
    1820import org.junit.Test;
    1921
     
    2830import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
    2931import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
     32import geniusweb.protocol.session.mopac.phase.OfferPhase;
     33import geniusweb.protocol.session.mopac.phase.Phase;
     34import geniusweb.protocol.session.mopac.phase.VotingPhase;
    3035import tudelft.utilities.logging.Reporter;
    3136import tudelft.utilities.repository.NoResourcesNowException;
     
    5762                        conn3 = mock(ProtocolToPartyConn.class);
    5863
     64        private List<ProtocolToPartyConn> connections;
     65
    5966        @Before
    6067        public void before() throws JsonParseException, JsonMappingException,
     
    6370                mopac = settings.getProtocol(logger);
    6471
    65                 List connections = Arrays.asList(conn1, conn2, conn3);
     72                connections = Arrays.asList(conn1, conn2, conn3);
    6673                when(factory.connect(any(List.class))).thenReturn(connections);
    6774
     
    94101        }
    95102
    96         @Ignore
    97103        @Test
    98104        public void testWorkingCheckDeadline()
     
    101107                mopac.start(factory);
    102108
    103                 System.out.println(mopac.getState());
    104 
     109                assertFalse(mopac.getState().isFinal(System.currentTimeMillis()));
    105110                // we have deadline in 100ms so check
    106111                Thread.sleep(200);
    107 
    108                 System.out.println(mopac.getState());
    109112                assertTrue(mopac.getState().isFinal(System.currentTimeMillis()));
    110113        }
    111114
    112         @Ignore
    113115        @Test
    114116        public void testSubscribedToConnections() {
     
    119121        }
    120122
    121         @Ignore
    122123        @Test
    123124        public void testActionIsBroadcast()
     
    134135        }
    135136
    136         @Test
    137         public void testAgreementTerminates() {
    138 
    139         }
     137        /**
     138         * Fatal error occurs, run should fail
     139         */
     140        @Test(expected = RuntimeException.class)
     141        public void testPartyFailsConnect()
     142                        throws IOException, NoResourcesNowException {
     143                ProtocolToPartyConnFactory factory1 = mock(
     144                                ProtocolToPartyConnFactory.class);
     145                // irrecoverable fail test
     146                when(factory1.connect(any(List.class)))
     147                                .thenThrow(new IOException("Failed to connect to parties"));
     148
     149                mopac.start(factory1);
     150
     151        }
     152
     153        /**
     154         * Nonfatal error occurs, protocol should retry till success
     155         */
     156        @Test
     157        public void testPartyFailsConnect2ndtimeOK()
     158                        throws IOException, NoResourcesNowException {
     159                long now = System.currentTimeMillis();
     160                ProtocolToPartyConnFactory factory1 = mock(
     161                                ProtocolToPartyConnFactory.class);
     162                // recoverable fail, and then success.
     163                when(factory1.connect(any(List.class)))
     164                                .thenThrow(new NoResourcesNowException("try again later",
     165                                                new Date(now + 100)))
     166                                .thenReturn(connections);
     167
     168                mopac.start(factory1);
     169
     170        }
     171
     172        /**
     173         * Test that in Offer phase, and party does action, the next phase is
     174         * entered.
     175         */
     176        @Test
     177        public void testProceedsNextPhase() {
     178                // the state before the last party makes the offer
     179                MOPACState offerstate = mock(MOPACState.class);
     180                when(offerstate.getSettings()).thenReturn(settings);
     181                OfferPhase offerphase = mock(OfferPhase.class);
     182                when(offerphase.isFinal(anyLong())).thenReturn(false);
     183                when(offerstate.getPhase()).thenReturn(offerphase);
     184
     185                // the phase where all parties placed an offer
     186                OfferPhase finalofferphase = mock(OfferPhase.class);
     187                when(finalofferphase.isFinal(anyLong())).thenReturn(true);
     188                MOPACState finalofferstate = mock(MOPACState.class);
     189                when(finalofferstate.getPhase()).thenReturn(finalofferphase);
     190                when(finalofferstate.finishPhase()).thenReturn(finalofferstate);
     191
     192                when(offerstate.with(any(PartyId.class), any(Action.class), anyLong()))
     193                                .thenReturn(finalofferstate);
     194
     195                // the phase where all parties can start voting.
     196                // this is the state to be reached.
     197                long now = System.currentTimeMillis();
     198                MOPACState votingstate = mock(MOPACState.class);
     199                Phase votingphase = mock(VotingPhase.class);
     200                PartyStates votingpartystates = mock(PartyStates.class);
     201                when(votingphase.getDeadline()).thenReturn(now + 100);
     202                when(votingphase.getPartyStates()).thenReturn(votingpartystates);
     203                when(votingstate.getPhase()).thenReturn(votingphase);
     204
     205                when(finalofferstate.nextPhase(anyLong())).thenReturn(votingstate);
     206
     207                mopac = new MOPAC(offerstate, logger);
     208                Offer action = mock(Offer.class);
     209                mopac.actionRequest(conn3, action, now);
     210
     211                // check that the action result in reaching the voting phase
     212                assertEquals(votingstate, mopac.getState());
     213        }
     214
    140215}
  • protocol/src/test/java/geniusweb/protocol/session/mopac/PartyStatesTest.java

    r21 r24  
    33import static org.junit.Assert.assertEquals;
    44
     5import java.io.IOException;
     6import java.net.URISyntaxException;
    57import java.util.Arrays;
    68import java.util.Collections;
    79import java.util.HashMap;
    810import java.util.HashSet;
     11import java.util.List;
    912import java.util.Map;
    1013
    1114import org.junit.Test;
    1215
     16import com.fasterxml.jackson.core.JsonProcessingException;
     17import com.fasterxml.jackson.databind.ObjectMapper;
     18
    1319import geniusweb.actions.PartyId;
    1420import geniusweb.inform.Agreements;
    1521import geniusweb.protocol.ProtocolException;
     22import tudelft.utilities.junit.GeneralTests;
    1623
    17 public class PartyStatesTest {
     24public class PartyStatesTest extends GeneralTests<PartyStates> {
     25        private final ObjectMapper jackson = new ObjectMapper();
    1826
    1927        private final PartyId party1 = new PartyId("party1");
     
    2230
    2331        private final Map<PartyId, Integer> powers = new HashMap<>();
    24         private final PartyStates states;
     32        private final PartyStates states1, states1a, states2;
     33        private final String serialized = "{\"notYetActed\":[\"party2\",\"party1\",\"party3\"],\"actions\":[],\"agreements\":{},\"walkedAway\":[],\"exceptions\":{},\"powers\":{\"party2\":3,\"party1\":2,\"party3\":3}}";
    2534
    2635        public PartyStatesTest() {
     36
     37                // FIXME use the other constructor to really test this.
     38//              PartyStates(Set<PartyId> notYetActed, List<Action> actions,
     39//                              Agreements agreements, List<PartyId> walkedAway,
     40//                              Map<PartyId, ProtocolException> exceptions,
     41//                              Map<PartyId, Integer> powers)
     42//             
    2743                powers.put(party1, 2);
    2844                powers.put(party2, 3);
     45                states2 = new PartyStates(powers);
    2946                powers.put(party3, 3);
    30                 states = new PartyStates(powers);
     47                states1 = new PartyStates(powers);
     48                states1a = new PartyStates(powers);
     49        }
     50
     51        @Override
     52        public List<List<PartyStates>> getGeneralTestData() {
     53                return Arrays.asList(Arrays.asList(states1, states1a),
     54                                Arrays.asList(states2));
     55        }
     56
     57        @Override
     58        public List<String> getGeneralTestStrings() {
     59                return Arrays.asList(
     60                                "PartyStates.*\\[party2, party1, party3\\],\\[\\],Agreements\\{\\},\\[\\],\\{\\}.*",
     61                                "PartyStates.*\\[party2, party1\\],\\[\\],Agreements\\{\\},\\[\\],\\{\\}.*");
    3162        }
    3263
    3364        @Test
    3465        public void testBasics() {
    35                 assertEquals(powers.keySet(), states.getNegotiatingParties());
    36                 assertEquals(powers.keySet(), states.getNotYetActed());
    37                 assertEquals(0, states.getExceptions().size());
     66                assertEquals(powers.keySet(), states1.getNegotiatingParties());
     67                assertEquals(powers.keySet(), states1.getNotYetActed());
     68                assertEquals(0, states1.getExceptions().size());
    3869        }
    3970
    4071        @Test
    4172        public void testException() {
    42                 PartyStates newstates = states
     73                PartyStates newstates = states1
    4374                                .with(new ProtocolException("bla", party1));
    4475                assertEquals(new Agreements(), newstates.getAgreements());
    45                 assertEquals(powers.keySet(), states.getNegotiatingParties());
     76                assertEquals(powers.keySet(), states1.getNegotiatingParties());
    4677                assertEquals(new HashSet<>(Arrays.asList(party2, party3)),
    4778                                newstates.getNotYetActed());
     
    5081        @Test
    5182        public void testFinish() {
    52                 PartyStates newstates = states.finish();
     83                PartyStates newstates = states1.finish();
    5384                assertEquals(new Agreements(), newstates.getAgreements());
    54                 assertEquals(powers.keySet(), states.getNegotiatingParties());
     85                assertEquals(powers.keySet(), states1.getNegotiatingParties());
    5586                assertEquals(Collections.emptySet(), newstates.getNotYetActed());
    5687        }
     88
     89        @Test
     90        public void testDeserialize() throws IOException {
     91                PartyStates obj = jackson.readValue(serialized, PartyStates.class);
     92                System.out.println(obj);
     93                assertEquals(states1, obj);
     94        }
     95
     96        @Test
     97        public void testSerialize()
     98                        throws JsonProcessingException, URISyntaxException {
     99
     100                String string = jackson.writeValueAsString(states1);
     101                System.out.println(string);
     102                assertEquals(serialized, string);
     103        }
     104
     105        @Test
     106        public void testWalkAway() {
     107                PartyStates walkawaystate = states1.withWalkAway(party2);
     108                assertEquals(new HashSet<>(Arrays.asList(party1, party3)),
     109                                walkawaystate.getNotYetActed());
     110                assertEquals(Arrays.asList(party2), walkawaystate.getWalkedAway());
     111        }
    57112}
  • protocol/src/test/java/geniusweb/protocol/session/mopac/phase/OfferPhaseTest.java

    r21 r24  
    44import static org.junit.Assert.assertFalse;
    55import static org.junit.Assert.assertTrue;
     6import static org.junit.Assert.fail;
    67import static org.mockito.Mockito.mock;
    7 
     8import static org.mockito.Mockito.when;
     9
     10import java.io.IOException;
     11import java.net.URISyntaxException;
     12import java.util.Arrays;
    813import java.util.Collections;
    914import java.util.HashMap;
     15import java.util.List;
    1016import java.util.Map;
    1117
    1218import org.junit.Test;
    1319
     20import com.fasterxml.jackson.core.JsonProcessingException;
     21import com.fasterxml.jackson.databind.ObjectMapper;
     22
     23import geniusweb.actions.Accept;
    1424import geniusweb.actions.EndNegotiation;
     25import geniusweb.actions.Offer;
    1526import geniusweb.actions.PartyId;
    1627import geniusweb.actions.Votes;
     28import geniusweb.inform.YourTurn;
     29import geniusweb.issuevalue.Bid;
     30import geniusweb.issuevalue.DiscreteValue;
    1731import geniusweb.protocol.ProtocolException;
    1832import geniusweb.protocol.session.mopac.PartyStates;
    1933import geniusweb.voting.VotingEvaluator;
     34import geniusweb.voting.votingevaluators.LargestAgreement;
     35import geniusweb.voting.votingevaluators.LargestAgreementsLoop;
     36import tudelft.utilities.junit.GeneralTests;
    2037
    2138/**
    2239 * We also test defaultPhase here.
    2340 */
    24 public class OfferPhaseTest {
    25 
     41public class OfferPhaseTest extends GeneralTests<OfferPhase> {
     42        private final ObjectMapper jackson = new ObjectMapper();
     43
     44        private static final long DEADLINE = 10l;
    2645        private final PartyId party1 = new PartyId("party1");
    2746        private final PartyId party2 = new PartyId("party2");
     
    2948
    3049        private final Map<PartyId, Integer> powers = new HashMap<>();
    31         private final PartyStates states;
    32         private final VotingEvaluator evaluator = mock(VotingEvaluator.class);
    33         private final OfferPhase phase;
     50        private final PartyStates states, states2;
     51        private final VotingEvaluator evaluator = new LargestAgreement();
     52        private final VotingEvaluator evaluator2 = new LargestAgreementsLoop();
     53        private final OfferPhase phase, phase1, phase1a, phase2, phase3, phase4;
     54
     55        // just a test bid
     56        private final Bid bid = new Bid("issue", new DiscreteValue("yes"));
     57        private final Offer offer = new Offer(party1, bid);
     58
     59        private final String serialized = "{\"OfferPhase\":{\"partyStates\":{\"notYetActed\":[\"party2\",\"party1\",\"party3\"],\"actions\":[],\"agreements\":{},\"walkedAway\":[],\"exceptions\":{},\"powers\":{\"party2\":3,\"party1\":2,\"party3\":3}},\"evaluator\":{\"LargestAgreement\":{}},\"deadline\":10}}";
    3460
    3561        public OfferPhaseTest() {
    3662                powers.put(party1, 2);
    3763                powers.put(party2, 3);
     64                states2 = new PartyStates(powers);
    3865                powers.put(party3, 3);
    3966                states = new PartyStates(powers);
    40                 phase = new OfferPhase(null, states, 10l, evaluator);
    41         }
    42 
    43         @Test
    44         public void isInitFinalTest() {
     67                phase = new OfferPhase(states, DEADLINE, evaluator);
     68
     69                phase1 = new OfferPhase(states, 10l, evaluator);
     70                phase1a = new OfferPhase(states, 10l, evaluator);
     71                phase2 = new OfferPhase(states2, 10l, evaluator);
     72                phase3 = new OfferPhase(states, 20l, evaluator);
     73                phase4 = new OfferPhase(states, 10l, evaluator2);
     74
     75        }
     76
     77        @Override
     78        public List<List<OfferPhase>> getGeneralTestData() {
     79                return Arrays.asList(Arrays.asList(phase1, phase1a),
     80                                Arrays.asList(phase2), Arrays.asList(phase3),
     81                                Arrays.asList(phase4));
     82        }
     83
     84        @Override
     85        public List<String> getGeneralTestStrings() {
     86                return Arrays.asList(
     87                                "OfferPhase.*PartyStates.*party2, party1, party3.*\\[\\],Agreements.*\\[\\],\\{\\}.*],10,LargestAgreement.*",
     88                                "OfferPhase.*PartyStates.*party2, party1.*\\[\\],Agreements.*\\[\\],\\{\\}.*],10,LargestAgreement.*",
     89                                "OfferPhase.*PartyStates.*party2, party1, party3.*\\[\\],Agreements.*\\[\\],\\{\\}.*],20,LargestAgreement.*",
     90                                "OfferPhase.*PartyStates.*party2, party1, party3.*\\[\\],Agreements.*\\[\\],\\{\\}.*],10,LargestAgreementsLoop.*");
     91        }
     92
     93        @Test
     94        public void smokeTest() {
     95        }
     96
     97        @Test
     98        public void testInitState() {
     99                assertEquals(3, phase.getPartyStates().getNotYetActed().size());
     100        }
     101
     102        @Test
     103        public void testInform() {
     104                assertEquals(new YourTurn(), phase.getInform());
     105        }
     106
     107        @Test
     108        public void isFinalTest() {
    45109                assertFalse(phase.isFinal(1l));
    46110                assertTrue(phase.isFinal(10l));
     111        }
     112
     113        @Test
     114        public void isFinalTestActorNotYetActed() {
     115                PartyStates actedstate = mock(PartyStates.class);
     116                when(actedstate.getNotYetActed())
     117                                .thenReturn(Collections.singleton(party1));
     118                OfferPhase testphase = new OfferPhase(actedstate, 10l, evaluator);
     119                assertFalse(testphase.isFinal(1l));
     120        }
     121
     122        @Test
     123        public void isFinalTestAllActorsActed() {
     124                PartyStates actedstate = mock(PartyStates.class);
     125                when(actedstate.getNotYetActed()).thenReturn(Collections.emptySet());
     126                OfferPhase testphase = new OfferPhase(actedstate, 10l, evaluator);
     127                assertTrue(testphase.isFinal(1l));
    47128        }
    48129
     
    65146        }
    66147
     148        @Test
     149        public void testFinish() {
     150                Phase ph = phase.finish();
     151                assertTrue(ph.getPartyStates().getNotYetActed().isEmpty());
     152                assertEquals(3, ph.getPartyStates().getExceptions().size());
     153                assertTrue(phase.getPartyStates().getAgreements().getMap().isEmpty());
     154        }
     155
     156        @Test(expected = IllegalStateException.class)
     157        public void testNextWrong() {
     158                // state is not final, should not work
     159                phase.next(1, 1000);
     160        }
     161
     162        @Test
     163        public void testNextNoParties() {
     164                Phase ph = phase.finish();
     165                // no parties are left now, all failed
     166                // but this is not part of the next() check.
     167                Phase next = ph.next(1, 1000);
     168                assertTrue(next instanceof VotingPhase);
     169                // no remaining parties, since finish kicked all
     170                assertTrue(next.getPartyStates().getNotYetActed().isEmpty());
     171        }
     172
     173        @Test
     174        public void testAllowed() {
     175                phase.with(party1, offer, 1);
     176        }
     177
     178        @Test
     179        public void testAllowedWrongClass() {
     180                try {
     181                        phase.checkAction(party1, new Accept(party1, bid), 1);
     182                } catch (ProtocolException e) {
     183                        assertTrue(e.getMessage().contains("not allowed in OfferPhase"));
     184                        return;
     185                }
     186                fail("checkAction did not throw as expected");
     187        }
     188
     189        @Test
     190        public void testAllowedWrongActor() {
     191                try {
     192                        phase.checkAction(party1, new Accept(party2, bid), 1);
     193                } catch (ProtocolException e) {
     194                        assertTrue(
     195                                        e.getMessage().contains("Incorrect actor info in action"));
     196                        return;
     197                }
     198                fail("checkAction did not throw as expected");
     199        }
     200
     201        @Test
     202        public void testAllowedActorAlreadyActed() {
     203                OfferPhase testphase = phase.with(party1, offer, 1);
     204
     205                try {
     206                        testphase.checkAction(party1, offer, 2);
     207                } catch (ProtocolException e) {
     208                        assertTrue(e.getMessage().contains("can not act anymore"));
     209                        return;
     210                }
     211                fail("checkAction did not throw as expected");
     212        }
     213
     214        @Test
     215        public void testAllowedActorAlreadyActed1() {
     216                // as theoprevious test, but using with() instead of checkAction
     217                OfferPhase testphase = phase.with(party1, offer, 1);
     218
     219                OfferPhase newphase = testphase.with(party1, offer, 2);
     220                // the party must remain as acted, because we can't retract his
     221                // action...
     222                assertEquals(1, newphase.getPartyStates().getActions().size());
     223                assertEquals(offer, newphase.getPartyStates().getActions().get(0));
     224                assertFalse(
     225                                newphase.getPartyStates().getExceptions().containsKey(party1));
     226        }
     227
     228        @Test
     229        public void testAllowedActingTooLate() {
     230
     231                try {
     232                        phase.checkAction(party1, offer, DEADLINE + 1);
     233                } catch (ProtocolException e) {
     234                        assertTrue(e.getMessage().contains("passed deadline"));
     235                        return;
     236                }
     237                fail("checkAction did not throw as expected");
     238        }
     239
     240        @Test
     241        public void getOffersTest() {
     242                assertEquals(Collections.emptyList(), phase.getOffers());
     243                List<Bid> offs = phase.with(party1, offer, 1).getOffers();
     244                assertEquals(Arrays.asList(bid), offs);
     245        }
     246
     247        @Test(expected = IllegalArgumentException.class)
     248        public void testNextTooShortDuration() {
     249                phase.next(1, Phase.PHASE_MINTIME - 1);
     250        }
     251
     252        @Test(expected = IllegalStateException.class)
     253        public void testNextNotFinished() {
     254                phase.next(1, Phase.PHASE_MINTIME + 1);
     255        }
     256
     257        @Test(expected = IllegalStateException.class)
     258        public void testNext() {
     259                phase.next(11, Phase.PHASE_MINTIME + 1);
     260        }
     261
     262        @Test
     263        public void testDeserialize() throws IOException {
     264                Phase obj = jackson.readValue(serialized, Phase.class);
     265                System.out.println(obj);
     266                assertEquals(phase1, obj);
     267        }
     268
     269        @Test
     270        public void testSerialize()
     271                        throws JsonProcessingException, URISyntaxException {
     272
     273                String string = jackson.writeValueAsString(phase1);
     274                System.out.println(string);
     275                assertEquals(serialized, string);
     276        }
    67277}
  • protocol/src/test/java/geniusweb/protocol/session/saop/SAOPTest.java

    r21 r24  
    3434import geniusweb.events.CurrentState;
    3535import geniusweb.events.ProtocolEvent;
     36import geniusweb.inform.Agreements;
    3637import geniusweb.inform.Finished;
    3738import geniusweb.inform.Inform;
     
    177178                when(state.toString()).thenReturn(asText);
    178179                when(state.with(any(ProtocolException.class))).thenReturn(failstate);
     180                when(state.getAgreements()).thenReturn(mock(Agreements.class));
    179181        }
    180182
     
    260262        @Test
    261263        public void testActionRequestWrongActor() {
    262 
    263264                saop.actionRequest(conn2, mock(EndNegotiation.class));
    264265
     
    290291                when(state.with(any(PartyId.class), any(EndNegotiation.class)))
    291292                                .thenReturn(finalstate);
     293                // when(finalstate.getAgreements()).thenReturn(mock(Agreements.class));
    292294
    293295                saop.actionRequest(conn1, mock(EndNegotiation.class));
     
    311313                doThrow(new IOException("fail sending yourturn")).when(conn1)
    312314                                .send(any(YourTurn.class));
    313 
     315                // CHECK is the state really final after an exception?
     316                when(state.with(any(ProtocolException.class))).thenReturn(finalstate);
     317                // when(state.getAgreements()).thenReturn(mock(Agreements.class));
    314318                saop.actionRequest(conn1, mock(Accept.class));
    315319
     
    322326                doThrow(new IOException("fail sending yourturn")).when(conn1)
    323327                                .send(any(YourTurn.class));
     328                // when(failstate.getAgreements()).thenReturn(mock(Agreements.class));
    324329                // not turn of conn2.
    325330                saop.actionRequest(conn2, mock(EndNegotiation.class));
     
    332337        public void testActionInFinalState() throws IOException {
    333338                saop = new SAOP(finalstate, new ReportToLogger("test"));
     339                // when(finalstate.getAgreements()).thenReturn(mock(Agreements.class));
    334340
    335341                saop.actionRequest(conn1, mock(Offer.class));
  • pythonadapter/pom.xml

    r23 r24  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>pythonadapter</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    8181                                <groupId>org.apache.maven.plugins</groupId>
    8282                                <artifactId>maven-javadoc-plugin</artifactId>
    83                                 <version>2.10.1</version>
     83                                <version>3.2.0</version>
    8484                                <executions>
    8585                                        <execution>
     
    8888                                                        <goal>jar</goal>
    8989                                                </goals>
    90                                                 <configuration>
    91                                                         <additionalparam>${javadoc.opts}</additionalparam>
    92                                                         <additionalparam>-Xdoclint:none</additionalparam>
    93                                                 </configuration>
    9490                                        </execution>
    9591                                </executions>
  • pythonadapter/src/main/java/geniusweb/pythonadapter/PythonPartyAdapter.java

    r21 r24  
    3636 * </ul>
    3737 *
    38  * <p>
    3938 * <h1>Working principle</h1>
    4039 *
  • references/pom.xml

    r23 r24  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>references</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    152152                                <groupId>org.apache.maven.plugins</groupId>
    153153                                <artifactId>maven-javadoc-plugin</artifactId>
    154                                 <version>2.10.1</version>
     154                                <version>3.2.0</version>
    155155                                <executions>
    156156                                        <execution>
     
    159159                                                        <goal>jar</goal>
    160160                                                </goals>
    161                                                 <configuration>
    162                                                         <additionalparam>${javadoc.opts}</additionalparam>
    163                                                         <additionalparam>-Xdoclint:none</additionalparam>
    164                                                 </configuration>
    165161                                        </execution>
    166162                                </executions>
  • references/src/main/java/geniusweb/connection/DefaultConnection.java

    r9 r24  
    66 * Default implementation of connection. Connection implementors only need to
    77 * implement the send (which moves the data sent into the connection to the
    8  * other side) and they can call {@link DefaultListenable#notifyChange(Object)}
    9  * to inform the users of the connection that something came in from the other
    10  * side.
     8 * other side) and they can call
     9 * {@link DefaultListenable#notifyListeners(Object)} to inform the users of the
     10 * connection that something came in from the other side.
    1111 *
    12  * @param <INTYPE> the datatype of objects received from the other side
    13  * @param <OUTTYPE> the datatype of objects sent to the other side.
     12 * @param INTYPE the datatype of objects received from the other side
     13 * @param OUTTYPE the datatype of objects sent to the other side.
    1414 */
    1515public abstract class DefaultConnection<INTYPE, OUTTYPE> extends
  • simplerunner/pom.xml

    r23 r24  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>simplerunner</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    139139                                <groupId>org.apache.maven.plugins</groupId>
    140140                                <artifactId>maven-javadoc-plugin</artifactId>
    141                                 <version>2.10.1</version>
     141                                <version>3.2.0</version>
    142142                                <executions>
    143143                                        <execution>
     
    146146                                                        <goal>jar</goal>
    147147                                                </goals>
    148                                                 <configuration>
    149                                                         <additionalparam>${javadoc.opts}</additionalparam>
    150                                                         <additionalparam>-Xdoclint:none</additionalparam>
    151                                                 </configuration>
    152148                                        </execution>
    153149                                </executions>
  • simplerunner/src/main/java/geniusweb/simplerunner/BasicConnection.java

    r21 r24  
    4343         * from us. Must be called first.
    4444         *
    45          * @param handler a Listener<OUT> that can handle send actions.
     45         * @param newhandler a Listener&lt;OUT&gt; that can handle send actions.
    4646         *
    4747         */
  • simplerunner/src/main/java/geniusweb/simplerunner/NegoRunner.java

    r21 r24  
    3636        /**
    3737         *
    38          * @param settings
    39          * @param connectionfactory
    40          * @param logger
     38         * @param settings          the {@link NegoSettings}
     39         * @param connectionfactory the {@link ProtocolToPartyConnFactory}
     40         * @param logger            the {@link Reporter} to log problems
    4141         * @param maxruntime        limit in millisecs. Ignored if 0
    4242         */
     
    5454        }
    5555
     56        /**
     57         *
     58         * @return true if the runner has finished
     59         */
    5660        public boolean isProperlyStopped() {
    5761                return properlyStopped;
     
    8892        /**
    8993         * Separate so that we can intercept this when mocking, as this will crash
    90          * on mocks
     94         * on mocks because {@link #jackson} can not handle mocks.
    9195         *
    92          * @param level
    93          * @param state
     96         * @param level the log {@link Level}
     97         * @param state the {@link NegoState} to log
    9498         */
    9599        protected void logFinal(Level level, NegoState state) {
     
    102106        }
    103107
     108        /**
     109         * The main runner
     110         *
     111         * @param args should have 1 argument, the settings.json file to be used.
     112         * @throws IOException if problem occurs
     113         */
    104114        public static void main(String[] args) throws IOException {
    105115                if (args.length != 1) {
  • timeline/pom.xml

    r23 r24  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>timeline</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1616                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1717                <jackson-2-version>2.9.10</jackson-2-version>
    18                 <geniusweb.version>1.5.2</geniusweb.version>
     18                <geniusweb.version>1.5.3</geniusweb.version>
    1919        </properties>
    2020
     
    140140                                <groupId>org.apache.maven.plugins</groupId>
    141141                                <artifactId>maven-javadoc-plugin</artifactId>
    142                                 <version>2.10.1</version>
     142                                <version>3.2.0</version>
    143143                                <executions>
    144144                                        <execution>
     
    147147                                                        <goal>jar</goal>
    148148                                                </goals>
    149                                                 <configuration>
    150                                                         <additionalparam>${javadoc.opts}</additionalparam>
    151                                                         <additionalparam>-Xdoclint:none</additionalparam>
    152                                                 </configuration>
    153149                                        </execution>
    154150                                </executions>
  • timeline/src/main/java/geniusweb/progress/ProgressTime.java

    r18 r24  
    3838        /**
    3939         *
    40          * @param duration the duration, eg {@link DeadlineTime#getDuration()}. Must
    41          *                 be >0.
    42          * @param start    the start Date (unix time in millisecs since 1970). See
    43          *                 {@link System#currentTimeMillis()}.
     40         * @param d     the duration, eg {@link DeadlineTime#getDuration()}. Must be
     41         *              &gt; 0.
     42         * @param start the start Date (unix time in millisecs since 1970). See
     43         *              {@link System#currentTimeMillis()}.
    4444         */
    4545        @JsonCreator
  • voting/pom.xml

    r23 r24  
    66        <groupId>geniusweb</groupId>
    77        <artifactId>voting</artifactId>
    8         <version>1.5.2</version> <!-- must equal ${geniusweb.version} -->
     8        <version>1.5.3</version> <!-- must equal ${geniusweb.version} -->
    99        <packaging>jar</packaging>
    1010
     
    1717                <passwd>${env.ARTIFACTORY_PASS}</passwd>
    1818                <jackson-2-version>2.9.10</jackson-2-version>
    19                 <geniusweb.version>1.5.2</geniusweb.version>
     19                <geniusweb.version>1.5.3</geniusweb.version>
    2020        </properties>
    2121
     
    156156                                <groupId>org.apache.maven.plugins</groupId>
    157157                                <artifactId>maven-javadoc-plugin</artifactId>
    158                                 <version>2.10.1</version>
     158                                <version>3.2.0</version>
    159159                                <executions>
    160160                                        <execution>
     
    163163                                                        <goal>jar</goal>
    164164                                                </goals>
    165                                                 <configuration>
    166                                                         <additionalparam>${javadoc.opts}</additionalparam>
    167                                                         <additionalparam>-Xdoclint:none</additionalparam>
    168                                                 </configuration>
    169165                                        </execution>
    170166                                </executions>
  • voting/src/main/java/geniusweb/voting/CollectedVotes.java

    r22 r24  
    176176
    177177        /**
    178          * @param voteList
     178         * @param voteList list of all {@link Vote}s
    179179         * @return all parties that did a vote
    180180         */
  • voting/src/main/java/geniusweb/voting/VotingEvaluator.java

    r21 r24  
    1616 *
    1717 * Implementations should be immutable and not serialize internal variables (eg
    18  *
    19  * @JsonIgnore them).
     18 * &#64;JsonIgnore them).
    2019 */
    2120@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE)
  • voting/src/main/java/geniusweb/voting/votingevaluators/LargestAgreementsLoop.java

    r21 r24  
    8888        }
    8989
     90        /**
     91         * WARNING you must manually set prime=37 here to fix collision with
     92         * {@link LargestAgreement}.
     93         */
    9094        @Override
    9195        public int hashCode() {
    92                 final int prime = 31;
     96                final int prime = 37;
    9397                int result = 1;
    9498                result = prime * result
Note: See TracChangeset for help on using the changeset viewer.