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