1 | package geniusweb.events;
|
---|
2 |
|
---|
3 | import com.fasterxml.jackson.annotation.JsonTypeName;
|
---|
4 |
|
---|
5 | @JsonTypeName("tournamentstarted")
|
---|
6 | public class TournamentStarted extends ProtocolEvent {
|
---|
7 | private Long numberOfSessions;
|
---|
8 |
|
---|
9 | @SuppressWarnings("unused") // deserialization
|
---|
10 | private TournamentStarted() {
|
---|
11 | numberOfSessions = null;
|
---|
12 | }
|
---|
13 |
|
---|
14 | /**
|
---|
15 | *
|
---|
16 | * @param numberOfSessions the total number of sessions in the tournament
|
---|
17 | */
|
---|
18 | public TournamentStarted(Long numberOfSessions) {
|
---|
19 | this.numberOfSessions = numberOfSessions;
|
---|
20 | }
|
---|
21 |
|
---|
22 | /**
|
---|
23 | *
|
---|
24 | * @param numberOfSessions the total number of sessions in the tournament
|
---|
25 | * @param now the current timestamp
|
---|
26 | */
|
---|
27 | public TournamentStarted(Long numberOfSessions, Long now) {
|
---|
28 | super(now);
|
---|
29 | this.numberOfSessions = numberOfSessions;
|
---|
30 | }
|
---|
31 |
|
---|
32 | public Long getNumberOfSessions() {
|
---|
33 | return numberOfSessions;
|
---|
34 | }
|
---|
35 |
|
---|
36 | @Override
|
---|
37 | public String toString() {
|
---|
38 | return "TournamentStarted[" + getTime() + "," + numberOfSessions + "]";
|
---|
39 | }
|
---|
40 |
|
---|
41 | @Override
|
---|
42 | public int hashCode() {
|
---|
43 | final int prime = 31;
|
---|
44 | int result = super.hashCode();
|
---|
45 | result = prime * result + ((numberOfSessions == null) ? 0
|
---|
46 | : numberOfSessions.hashCode());
|
---|
47 | return result;
|
---|
48 | }
|
---|
49 |
|
---|
50 | @Override
|
---|
51 | public boolean equals(Object obj) {
|
---|
52 | if (this == obj)
|
---|
53 | return true;
|
---|
54 | if (!super.equals(obj))
|
---|
55 | return false;
|
---|
56 | if (getClass() != obj.getClass())
|
---|
57 | return false;
|
---|
58 | TournamentStarted other = (TournamentStarted) obj;
|
---|
59 | if (numberOfSessions == null) {
|
---|
60 | if (other.numberOfSessions != null)
|
---|
61 | return false;
|
---|
62 | } else if (!numberOfSessions.equals(other.numberOfSessions))
|
---|
63 | return false;
|
---|
64 | return true;
|
---|
65 | }
|
---|
66 |
|
---|
67 | }
|
---|