-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMessage.java
75 lines (65 loc) · 2.1 KB
/
Message.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
/**
* All constructors differentiate from each other in order to maximize usability.
*/
public class Message implements Serializable {
private static final long serialVersionUID = 12345L;
HashMap<String, String> ports = new HashMap<>();
ArrayList<String> topics;
String busline, data, PubSubBrok,lineCode,RouteCode,Vehicle;
int port;
String ip;
public Message(String PubSubBrok, String busline, String data) {
super();
this.PubSubBrok = PubSubBrok;
this.busline = busline;
this.data = data;
}
public Message(String PubSubBrok, String lineCode, String RouteCode,String VehicleId,String data){
super();
this.PubSubBrok = PubSubBrok;
this.lineCode = lineCode;
this.Vehicle=VehicleId;
this.RouteCode=RouteCode;
this.data = data;
}
public void setPubSubBrok(String pubSubBrok) {
PubSubBrok = pubSubBrok;
}
public Message(String PubSubBrok, String busLine , String lineCode, String RouteCode, String VehicleId, String data){
super();
this.busline=busLine;
this.PubSubBrok = PubSubBrok;
this.lineCode = lineCode;
this.Vehicle=VehicleId;
this.RouteCode=RouteCode;
this.data = data;
}
public Message(ArrayList<String> topics,String IP ,int port) {
this.topics = topics;
this.port = port;
this.ip=IP;
}
public Message(ArrayList<String> topics, int port) {
this.topics = topics;
this.port = port;
}
public Message(ArrayList<String> topics, HashMap<String, String> ports) {
this.topics = topics;
this.ports = ports;
}
public String getPubSub() {
return PubSubBrok;
}
/**
* This method returns the bus line and the current location.
* Overrides toString().
*
* @return Bus Line plus longitude, latitude.
*/
public String toString() {
return busline + ": " + data;
}
}