Line | |
---|
1 | package geniusweb.inform;
|
---|
2 |
|
---|
3 | import com.fasterxml.jackson.annotation.JsonCreator;
|
---|
4 | import com.fasterxml.jackson.annotation.JsonProperty;
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * Informs that the session is finished, and also contains the bid that was
|
---|
8 | * agreed on.
|
---|
9 | *
|
---|
10 | */
|
---|
11 | public class Finished implements Inform {
|
---|
12 | private final Agreements agreements;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * The session finished (can be for any reason).
|
---|
16 | *
|
---|
17 | * @param agreements the {@link Agreements} that were finally agreed on.
|
---|
18 | */
|
---|
19 | @JsonCreator
|
---|
20 | public Finished(@JsonProperty("agreements") Agreements agreements) {
|
---|
21 | if (agreements == null)
|
---|
22 | throw new NullPointerException("Agreements can't be null");
|
---|
23 | this.agreements = agreements;
|
---|
24 | }
|
---|
25 |
|
---|
26 | public Agreements getAgreements() {
|
---|
27 | return agreements;
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public int hashCode() {
|
---|
32 | final int prime = 31;
|
---|
33 | int result = 1;
|
---|
34 | result = prime * result
|
---|
35 | + ((agreements == null) ? 0 : agreements.hashCode());
|
---|
36 | return result;
|
---|
37 | }
|
---|
38 |
|
---|
39 | @Override
|
---|
40 | public boolean equals(Object obj) {
|
---|
41 | if (this == obj)
|
---|
42 | return true;
|
---|
43 | if (obj == null)
|
---|
44 | return false;
|
---|
45 | if (getClass() != obj.getClass())
|
---|
46 | return false;
|
---|
47 | Finished other = (Finished) obj;
|
---|
48 | if (agreements == null) {
|
---|
49 | if (other.agreements != null)
|
---|
50 | return false;
|
---|
51 | } else if (!agreements.equals(other.agreements))
|
---|
52 | return false;
|
---|
53 | return true;
|
---|
54 | }
|
---|
55 |
|
---|
56 | @Override
|
---|
57 | public String toString() {
|
---|
58 | return "Finished[" + agreements + "]";
|
---|
59 | }
|
---|
60 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.