Changeset 8 for party/src/main
- Timestamp:
- 09/30/19 15:37:05 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
party/src/main/java/geniusweb/party/inform/Settings.java
r1 r8 1 1 package geniusweb.party.inform; 2 3 import java.util.HashMap; 2 4 3 5 import com.fasterxml.jackson.annotation.JsonCreator; … … 5 7 6 8 import geniusweb.actions.PartyId; 9 import geniusweb.party.Party; 7 10 import geniusweb.progress.Progress; 11 import geniusweb.references.Parameters; 8 12 import geniusweb.references.ProfileRef; 9 13 import geniusweb.references.ProtocolRef; 10 14 11 15 /** 12 * Informs a party about all settings for the upcoming negotiation session. This 13 * should be sent to a party one time, so that the party knows the situation. 16 * Informs a {@link Party} about all settings for the upcoming negotiation 17 * session. This should be sent to a party one time, so that the party knows the 18 * situation. 14 19 * 15 20 */ … … 19 24 private Progress progress; 20 25 private PartyId id; 26 private Parameters parameters; 21 27 28 /** 29 * 30 * @param id the {@link PartyId} for this party 31 * @param profile the profile used for this party in this session 32 * @param protocol the protocol used in this session 33 * @param progress the {@link Progress} object used for this session 34 * @param parameters a Map<String, Object> containing initialization 35 * parameters for this party. The Object can be a HashMap, 36 * ArrayList, String, or number (Integer, Double, etc). 37 * The Object should not be just any Object because 38 * deserialization will work only with the mentioned 39 * types. 40 */ 22 41 @JsonCreator 23 42 public Settings(@JsonProperty("id") PartyId id, 24 43 @JsonProperty("profile") ProfileRef profile, 25 44 @JsonProperty("protocol") ProtocolRef protocol, 26 @JsonProperty("progress") Progress progress) { 27 if (profile == null || protocol == null || progress == null) { 45 @JsonProperty("progress") Progress progress, 46 @JsonProperty("parameters") Parameters parameters) { 47 if (profile == null || protocol == null || progress == null 48 || parameters == null) { 28 49 throw new IllegalArgumentException( 29 "party, profile, protocol and progress must be not null.");50 "party, profile, protocol, parameters and progress must be not null."); 30 51 } 31 52 this.profile = profile; 32 53 this.protocol = protocol; 33 54 this.progress = progress; 55 this.parameters = parameters; 34 56 this.id = id; 35 57 } 36 58 59 /** 60 * 61 * @return the profile used for this party in this session 62 */ 37 63 public ProfileRef getProfile() { 38 64 return profile; … … 43 69 } 44 70 71 /** 72 * 73 * @return the {@link Progress} object used for this session 74 */ 45 75 public Progress getProgress() { 46 76 return progress; 47 77 } 48 78 79 /** 80 * @return the party ID of this party 81 */ 49 82 public PartyId getID() { 50 83 return id; 84 } 85 86 /** 87 * 88 * @return a HashMap<String,Object> containing initialization parameters 89 * that can be used by the party. 90 */ 91 public HashMap<String, Object> getParemeters() { 92 return parameters; 51 93 } 52 94 … … 54 96 public String toString() { 55 97 return "Settings[" + id + "," + profile + "," + protocol + "," 56 + progress + " ]";98 + progress + "," + parameters + "]"; 57 99 } 58 100 … … 62 104 int result = 1; 63 105 result = prime * result + ((id == null) ? 0 : id.hashCode()); 106 result = prime * result 107 + ((parameters == null) ? 0 : parameters.hashCode()); 64 108 result = prime * result + ((profile == null) ? 0 : profile.hashCode()); 65 109 result = prime * result … … 84 128 } else if (!id.equals(other.id)) 85 129 return false; 130 if (parameters == null) { 131 if (other.parameters != null) 132 return false; 133 } else if (!parameters.equals(other.parameters)) 134 return false; 86 135 if (profile == null) { 87 136 if (other.profile != null)
Note:
See TracChangeset
for help on using the changeset viewer.