Changeset 24 for events


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.

Location:
events
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.