1 package net.sourceforge.basher.events;
2
3 import net.sourceforge.basher.BasherContext;
4 import net.sourceforge.basher.Phase;
5
6
7
8
9
10
11
12 public class PhaseTransitionEvent extends BasherEvent
13 {
14 private BasherContext _basherContext;
15 private Phase _oldPhase;
16 private Phase _newPhase;
17 private long _durationNextPhase;
18
19
20
21
22
23
24
25
26 public PhaseTransitionEvent( final BasherContext basherContext, final Phase oldPhase, final Phase newPhase, final long durationNextPhase )
27 {
28 _basherContext = basherContext;
29 _oldPhase = oldPhase;
30 _newPhase = newPhase;
31 _durationNextPhase = durationNextPhase;
32 }
33
34 public long getDurationNextPhase()
35 {
36 return _durationNextPhase;
37 }
38
39 public BasherContext getBasherContext()
40 {
41 return _basherContext;
42 }
43
44 public Phase getOldPhase()
45 {
46 return _oldPhase;
47 }
48
49 public Phase getNewPhase()
50 {
51 return _newPhase;
52 }
53
54 public boolean equals(final Object o)
55 {
56 if (this == o)
57 {
58 return true;
59 }
60 if (o == null || getClass() != o.getClass())
61 {
62 return false;
63 }
64
65 final PhaseTransitionEvent event = (PhaseTransitionEvent) o;
66
67 if (_basherContext != null ? !_basherContext.equals(event._basherContext) : event._basherContext != null)
68 {
69 return false;
70 }
71 if (_newPhase != event._newPhase)
72 {
73 return false;
74 }
75 if (_oldPhase != event._oldPhase)
76 {
77 return false;
78 }
79
80 return true;
81 }
82
83 public int hashCode()
84 {
85 int result;
86 result = (_basherContext != null ? _basherContext.hashCode() : 0);
87 result = 31 * result + (_oldPhase != null ? _oldPhase.hashCode() : 0);
88 result = 31 * result + (_newPhase != null ? _newPhase.hashCode() : 0);
89 return result;
90 }
91
92 public String toString()
93 {
94 return "PhaseTransitionEvent{" +
95 "_basherContext=" + _basherContext +
96 ", _oldPhase=" + _oldPhase +
97 ", _newPhase=" + _newPhase +
98 '}';
99 }
100 }