1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package triptracker.client.net;
21
22 import java.io.IOException;
23 import java.util.List;
24
25 import triptracker.core.ConnectionState;
26 import triptracker.core.Coordinate;
27 import triptracker.core.Route;
28 import triptracker.core.User;
29
30 /***
31 * An abstract adapter class for receiving map socket events. The methods in
32 * this class are empty. This class exists as convenience for creating listener
33 * objects.
34 * <p>
35 * Extend this class to create a MapSocketConnection listener and override the
36 * methods for the events of interest. (If you implement the MapSocketListener
37 * interface, you have to define all of the methods in it. This abstract class
38 * defines null methods for them all, so you only have to define methods for
39 * events you care about.)
40 * <p>
41 * Create a listener object using the extended class and then register it with a
42 * MapSocketConnection using the socket's addListener method. When the socket's
43 * status changes, the relevant method in the listener object is invoked.
44 */
45 public abstract class MapSocketAdapter implements MapSocketListener {
46
47 /***
48 * {@inheritDoc}
49 */
50 public void connectionUpdate(ConnectionState state) { }
51
52 /***
53 * {@inheritDoc}
54 */
55 public void invalidMessage(String message) { }
56
57 /***
58 * {@inheritDoc}
59 */
60 public void socketError(IOException e) { }
61
62 /***
63 * {@inheritDoc}
64 */
65 public void coordReceived(int routeId, Coordinate coordinate) { }
66
67 /***
68 * {@inheritDoc}
69 */
70 public void coordsReceived(List<Coordinate> coords) { }
71
72 /***
73 * {@inheritDoc}
74 */
75 public void routeList(List<Route> routes) { }
76
77 /***
78 * {@inheritDoc}
79 */
80 public void routeReceived(int routeId, List<Coordinate> coordinates) { }
81
82 /***
83 * {@inheritDoc}
84 */
85 public void routeUpdate(int routeId, RouteState state) { }
86
87 /***
88 * {@inheritDoc}
89 */
90 public void usersReceived(List<User> users) { }
91
92 /***
93 * {@inheritDoc}
94 */
95 public void userReceived(User user){ }
96 }